<!doctype html>
<html>
<head>
<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>
<title>快速阶乘算法</title><link href='https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext' rel='stylesheet' type='text/css' /><style type='text/css'>html {overflow-x: initial !important;}:root { --bg-color:#ffffff; --text-color:#333333; --select-text-bg-color:#B5D6FC; --select-text-font-color:auto; --monospace:"Lucida Console",Consolas,"Courier",monospace; }
html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0px; padding: 0px; height: auto; bottom: 0px; top: 0px; left: 0px; right: 0px; font-size: 1rem; line-height: 1.42857; overflow-x: hidden; background: inherit; tab-size: 4; }
iframe { margin: auto; }
a.url { word-break: break-all; }
a:active, a:hover { outline: 0px; }
.in-text-selection, ::selection { text-shadow: none; background: var(--select-text-bg-color); color: var(--select-text-font-color); }
#write { margin: 0px auto; height: auto; width: inherit; word-break: normal; overflow-wrap: break-word; position: relative; white-space: normal; overflow-x: visible; padding-top: 40px; }
#write.first-line-indent p { text-indent: 2em; }
#write.first-line-indent li p, #write.first-line-indent p * { text-indent: 0px; }
#write.first-line-indent li { margin-left: 2em; }
.for-image #write { padding-left: 8px; padding-right: 8px; }
body.typora-export { padding-left: 30px; padding-right: 30px; }
.typora-export .footnote-line, .typora-export li, .typora-export p { white-space: pre-wrap; }
.typora-export .task-list-item input { pointer-events: none; }
@media screen and (max-width: 500px) {
  body.typora-export { padding-left: 0px; padding-right: 0px; }
  #write { padding-left: 20px; padding-right: 20px; }
  .CodeMirror-sizer { margin-left: 0px !important; }
  .CodeMirror-gutters { display: none !important; }
}
#write li > figure:last-child { margin-bottom: 0.5rem; }
#write ol, #write ul { position: relative; }
img { max-width: 100%; vertical-align: middle; image-orientation: from-image; }
button, input, select, textarea { color: inherit; font: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
*, ::after, ::before { box-sizing: border-box; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { position: relative; }
p { line-height: inherit; }
h1, h2, h3, h4, h5, h6 { break-after: avoid-page; break-inside: avoid; orphans: 4; }
p { orphans: 4; }
h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }
.md-math-block, .md-rawblock, h1, h2, h3, h4, h5, h6, p { margin-top: 1rem; margin-bottom: 1rem; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic; }
a { cursor: pointer; }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); border-radius: 4px; cursor: pointer; }
sup.md-footnote a, sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; }
figure { overflow-x: auto; margin: 1.2em 0px; max-width: calc(100% + 16px); padding: 0px; }
figure > table { margin: 0px; }
tr { break-inside: avoid; break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; break-inside: auto; text-align: left; }
table.md-table td { min-width: 32px; }
.CodeMirror-gutters { border-right: 0px; background-color: inherit; }
.CodeMirror-linenumber { user-select: none; }
.CodeMirror { text-align: left; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
#write pre { white-space: pre-wrap; }
#write.fences-no-line-wrapping pre { white-space: pre; }
#write pre.ty-contain-cm { white-space: normal; }
.CodeMirror-gutters { margin-right: 4px; }
.md-fences { font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; overflow: visible; white-space: pre; background: inherit; position: relative !important; }
.md-diagram-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px; overflow-x: auto; }
#write .md-fences.mock-cm { white-space: pre-wrap; }
.md-fences.md-fences-with-lineno { padding-left: 0px; }
#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre; overflow-x: auto; }
.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px; }
.CodeMirror-line, twitterwidget { break-inside: avoid; }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em; }
.footnotes + .footnotes { margin-top: 0px; }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; background: 0px 0px; text-decoration: none; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; direction: ltr; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li .mathjax-block, li p { margin: 0.5rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child, li > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal; }
#write .footnote-line { white-space: pre-wrap; }
@media print {
  body, html { border: 1px solid transparent; height: 99%; break-after: avoid; break-before: avoid; font-variant-ligatures: no-common-ligatures; }
  #write { margin-top: 0px; padding-top: 0px; border-color: transparent !important; }
  .typora-export * { -webkit-print-color-adjust: exact; }
  html.blink-to-pdf { font-size: 13px; }
  .typora-export #write { break-after: avoid; }
  .typora-export #write::after { height: 0px; }
  .is-mac table { break-inside: avoid; }
}
.footnote-line { margin-top: 0.714em; font-size: 0.7em; }
a img, img a { cursor: pointer; }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block; overflow-x: hidden; }
p > .md-image:only-child:not(.md-img-error) img, p > img:only-child { display: block; margin: auto; }
#write.first-line-indent p > .md-image:only-child:not(.md-img-error) img { left: -2em; position: relative; }
p > .md-image:only-child { display: inline-block; width: 100%; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.md-math-block { width: 100%; }
.md-math-block:not(:empty)::after { display: none; }
[contenteditable="true"]:active, [contenteditable="true"]:focus, [contenteditable="false"]:active, [contenteditable="false"]:focus { outline: 0px; box-shadow: none; }
.md-task-list-item { position: relative; list-style-type: none; }
.task-list-item.md-task-list-item { padding-left: 0px; }
.md-task-list-item > input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em - 10px); border: none; }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc-content::after, .md-toc::after { display: none; }
.md-toc-item { display: block; color: rgb(65, 131, 196); }
.md-toc-item a { text-decoration: none; }
.md-toc-inner:hover { text-decoration: underline; }
.md-toc-inner { display: inline-block; cursor: pointer; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
@media screen and (max-width: 48em) {
  .md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
  .md-toc-h4 .md-toc-inner { margin-left: 5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
  .md-toc-h6 .md-toc-inner { margin-left: 8em; }
}
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
code, pre, samp, tt { font-family: var(--monospace); }
kbd { margin: 0px 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgb(36, 39, 41); background: rgb(255, 255, 255); border: 1px solid rgb(173, 179, 185); border-radius: 3px; box-shadow: rgba(12, 13, 14, 0.2) 0px 1px 0px, rgb(255, 255, 255) 0px 0px 0px 2px inset; white-space: nowrap; vertical-align: middle; }
.md-comment { color: rgb(162, 127, 3); opacity: 0.8; font-family: var(--monospace); }
code { text-align: left; vertical-align: initial; }
a.md-print-anchor { white-space: pre !important; border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important; text-shadow: initial !important; }
.md-inline-math .MathJax_SVG .noError { display: none !important; }
.html-for-mac .inline-math-svg .MathJax_SVG { vertical-align: 0.2px; }
.md-math-block .MathJax_SVG_Display { text-align: center; margin: 0px; position: relative; text-indent: 0px; max-width: none; max-height: none; min-height: 0px; min-width: 100%; width: auto; overflow-y: hidden; display: block !important; }
.MathJax_SVG_Display, .md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important; }
.MathJax_SVG .MJX-monospace { font-family: var(--monospace); }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif; }
.MathJax_SVG { display: inline; font-style: normal; font-weight: 400; line-height: normal; zoom: 90%; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin: 0px; }
.MathJax_SVG * { transition: none 0s ease 0s; }
.MathJax_SVG_Display svg { vertical-align: middle !important; margin-bottom: 0px !important; margin-top: 0px !important; }
.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif; }
.md-diagram-panel > svg { max-width: 100%; }
[lang="flow"] svg, [lang="mermaid"] svg { max-width: 100%; height: auto; }
[lang="mermaid"] .node text { font-size: 1rem; }
table tr th { border-bottom: 0px; }
video { max-width: 100%; display: block; margin: 0px auto; }
iframe { max-width: 100%; width: 100%; border: none; }
.highlight td, .highlight tr { border: 0px; }
svg[id^="mermaidChart"] { line-height: 1em; }
mark { background: rgb(255, 255, 0); color: rgb(0, 0, 0); }
.md-html-inline .md-plain, .md-html-inline strong, mark .md-inline-math, mark strong { color: inherit; }
mark .md-meta { color: rgb(0, 0, 0); opacity: 0.3 !important; }
@media print {
  .typora-export h1, .typora-export h2, .typora-export h3, .typora-export h4, .typora-export h5, .typora-export h6 { break-inside: avoid; }
}


.CodeMirror { height: auto; }
.CodeMirror.cm-s-inner { background: inherit; }
.CodeMirror-scroll { overflow: auto hidden; z-index: 3; }
.CodeMirror-gutter-filler, .CodeMirror-scrollbar-filler { background-color: rgb(255, 255, 255); }
.CodeMirror-gutters { border-right: 1px solid rgb(221, 221, 221); background: inherit; white-space: nowrap; }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153); }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(34, 17, 153); }
.cm-s-inner .cm-number { color: rgb(17, 102, 68); }
.cm-s-inner .cm-def { color: rgb(0, 0, 255); }
.cm-s-inner .cm-variable { color: rgb(0, 0, 0); }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170); }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85); }
.cm-s-inner .cm-string { color: rgb(170, 17, 17); }
.cm-s-inner .cm-property { color: rgb(0, 0, 0); }
.cm-s-inner .cm-operator { color: rgb(152, 26, 26); }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(170, 85, 0); }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0); }
.cm-s-inner .cm-meta { color: rgb(85, 85, 85); }
.cm-s-inner .cm-qualifier { color: rgb(85, 85, 85); }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170); }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119); }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0); }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204); }
.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: rgb(0, 0, 255); }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(0, 153, 0); }
.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgb(153, 153, 153); }
.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgb(0, 0, 204); }
.cm-negative { color: rgb(221, 68, 68); }
.cm-positive { color: rgb(34, 153, 34); }
.cm-header, .cm-strong { font-weight: 700; }
.cm-del { text-decoration: line-through; }
.cm-em { font-style: italic; }
.cm-link { text-decoration: underline; }
.cm-error { color: red; }
.cm-invalidchar { color: red; }
.cm-constant { color: rgb(38, 139, 210); }
.cm-defined { color: rgb(181, 137, 0); }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0); }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34); }
.cm-s-inner .CodeMirror-activeline-background { background: inherit; }
.CodeMirror { position: relative; overflow: hidden; }
.CodeMirror-scroll { height: 100%; outline: 0px; position: relative; box-sizing: content-box; background: inherit; }
.CodeMirror-sizer { position: relative; }
.CodeMirror-gutter-filler, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none; }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow: hidden; }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow: hidden; }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px; }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px; }
.CodeMirror-gutters { position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3; }
.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block; }
.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: 0px 0px !important; border: none !important; }
.CodeMirror-gutter-background { position: absolute; top: 0px; bottom: 0px; z-index: 4; }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4; }
.CodeMirror-lines { cursor: text; }
.CodeMirror pre { border-radius: 0px; border-width: 0px; background: 0px 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; overflow-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible; }
.CodeMirror-wrap pre { overflow-wrap: break-word; white-space: pre-wrap; word-break: normal; }
.CodeMirror-code pre { border-right: 30px solid transparent; width: fit-content; }
.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto; }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0; }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto; }
.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden; }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden; }
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right: none; width: 0px; }
.CodeMirror div.CodeMirror-cursor { visibility: hidden; }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit; }
.cm-searching { background: rgba(255, 255, 0, 0.4); }
@media print {
  .CodeMirror div.CodeMirror-cursor { visibility: hidden; }
}


:root {
    --side-bar-bg-color: #fafafa;
    --control-text-color: #777;
}

@include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext);

/* open-sans-regular - latin-ext_latin */
  /* open-sans-italic - latin-ext_latin */
    /* open-sans-700 - latin-ext_latin */
    /* open-sans-700italic - latin-ext_latin */
  html {
    font-size: 16px;
}

body {
    font-family: "Open Sans","Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: rgb(51, 51, 51);
    line-height: 1.6;
}

#write {
    max-width: 860px;
  	margin: 0 auto;
  	padding: 30px;
    padding-bottom: 100px;
}

@media only screen and (min-width: 1400px) {
	#write {
		max-width: 1024px;
	}
}

@media only screen and (min-width: 1800px) {
	#write {
		max-width: 1200px;
	}
}

#write > ul:first-child,
#write > ol:first-child{
    margin-top: 30px;
}

a {
    color: #4183C4;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: bold;
    line-height: 1.4;
    cursor: text;
}
h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
    text-decoration: none;
}
h1 tt,
h1 code {
    font-size: inherit;
}
h2 tt,
h2 code {
    font-size: inherit;
}
h3 tt,
h3 code {
    font-size: inherit;
}
h4 tt,
h4 code {
    font-size: inherit;
}
h5 tt,
h5 code {
    font-size: inherit;
}
h6 tt,
h6 code {
    font-size: inherit;
}
h1 {
    font-size: 2.25em;
    line-height: 1.2;
    border-bottom: 1px solid #eee;
}
h2 {
    font-size: 1.75em;
    line-height: 1.225;
    border-bottom: 1px solid #eee;
}

/*@media print {
    .typora-export h1,
    .typora-export h2 {
        border-bottom: none;
        padding-bottom: initial;
    }

    .typora-export h1::after,
    .typora-export h2::after {
        content: "";
        display: block;
        height: 100px;
        margin-top: -96px;
        border-top: 1px solid #eee;
    }
}*/

h3 {
    font-size: 1.5em;
    line-height: 1.43;
}
h4 {
    font-size: 1.25em;
}
h5 {
    font-size: 1em;
}
h6 {
   font-size: 1em;
    color: #777;
}
p,
blockquote,
ul,
ol,
dl,
table{
    margin: 0.8em 0;
}
li>ol,
li>ul {
    margin: 0 0;
}
hr {
    height: 2px;
    padding: 0;
    margin: 16px 0;
    background-color: #e7e7e7;
    border: 0 none;
    overflow: hidden;
    box-sizing: content-box;
}

li p.first {
    display: inline-block;
}
ul,
ol {
    padding-left: 30px;
}
ul:first-child,
ol:first-child {
    margin-top: 0;
}
ul:last-child,
ol:last-child {
    margin-bottom: 0;
}
blockquote {
    border-left: 4px solid #dfe2e5;
    padding: 0 15px;
    color: #777777;
}
blockquote blockquote {
    padding-right: 0;
}
table {
    padding: 0;
    word-break: initial;
}
table tr {
    border-top: 1px solid #dfe2e5;
    margin: 0;
    padding: 0;
}
table tr:nth-child(2n),
thead {
    background-color: #f8f8f8;
}
table tr th {
    font-weight: bold;
    border: 1px solid #dfe2e5;
    border-bottom: 0;
    margin: 0;
    padding: 6px 13px;
}
table tr td {
    border: 1px solid #dfe2e5;
    margin: 0;
    padding: 6px 13px;
}
table tr th:first-child,
table tr td:first-child {
    margin-top: 0;
}
table tr th:last-child,
table tr td:last-child {
    margin-bottom: 0;
}

.CodeMirror-lines {
    padding-left: 4px;
}

.code-tooltip {
    box-shadow: 0 1px 1px 0 rgba(0,28,36,.3);
    border-top: 1px solid #eef2f2;
}

.md-fences,
code,
tt {
    border: 1px solid #e7eaed;
    background-color: #f8f8f8;
    border-radius: 3px;
    padding: 0;
    padding: 2px 4px 0px 4px;
    font-size: 0.9em;
}

code {
    background-color: #f3f4f4;
    padding: 0 2px 0 2px;
}

.md-fences {
    margin-bottom: 15px;
    margin-top: 15px;
    padding-top: 8px;
    padding-bottom: 6px;
}


.md-task-list-item > input {
  margin-left: -1.3em;
}

@media print {
    html {
        font-size: 13px;
    }
    table,
    pre {
        page-break-inside: avoid;
    }
    pre {
        word-wrap: break-word;
    }
}

.md-fences {
	background-color: #f8f8f8;
}
#write pre.md-meta-block {
	padding: 1rem;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f7f7f7;
    border: 0;
    border-radius: 3px;
    color: #777777;
    margin-top: 0 !important;
}

.mathjax-block>.code-tooltip {
	bottom: .375rem;
}

.md-mathjax-midline {
    background: #fafafa;
}

#write>h3.md-focus:before{
	left: -1.5625rem;
	top: .375rem;
}
#write>h4.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h5.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h6.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
.md-image>.md-meta {
    /*border: 1px solid #ddd;*/
    border-radius: 3px;
    padding: 2px 0px 0px 4px;
    font-size: 0.9em;
    color: inherit;
}

.md-tag {
    color: #a7a7a7;
    opacity: 1;
}

.md-toc { 
    margin-top:20px;
    padding-bottom:20px;
}

.sidebar-tabs {
    border-bottom: none;
}

#typora-quick-open {
    border: 1px solid #ddd;
    background-color: #f8f8f8;
}

#typora-quick-open-item {
    background-color: #FAFAFA;
    border-color: #FEFEFE #e5e5e5 #e5e5e5 #eee;
    border-style: solid;
    border-width: 1px;
}

/** focus mode */
.on-focus-mode blockquote {
    border-left-color: rgba(85, 85, 85, 0.12);
}

header, .context-menu, .megamenu-content, footer{
    font-family: "Segoe UI", "Arial", sans-serif;
}

.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state{
    visibility: visible;
}

.mac-seamless-mode #typora-sidebar {
    background-color: #fafafa;
    background-color: var(--side-bar-bg-color);
}

.md-lang {
    color: #b4654d;
}

.html-for-mac .context-menu {
    --item-hover-bg-color: #E6F0FE;
}

#md-notification .btn {
    border: 0;
}

.dropdown-menu .divider {
    border-color: #e5e5e5;
}

.ty-preferences .window-content {
    background-color: #fafafa;
}

.ty-preferences .nav-group-item.active {
    color: white;
    background: #999;
}


</style>
</head>
<body class='typora-export os-windows'>
<div id='write'  class=''><p><span>快速计算阶乘。</span></p><!--more--><h1><a name="log方做法" class="md-header-anchor"></a><span>log方做法</span></h1><p><span>把 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="14.311ex" height="1.994ex" viewBox="0 -755.9 6161.8 858.4" role="img" focusable="false" style="vertical-align: -0.238ex;"><defs><path stroke-width="0" id="E1-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path stroke-width="0" id="E1-MJMAIN-22C5" d="M78 250Q78 274 95 292T138 310Q162 310 180 294T199 251Q199 226 182 208T139 190T96 207T78 250Z"></path><path stroke-width="0" id="E1-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="0" id="E1-MJMAIN-33" d="M127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463Z"></path><path stroke-width="0" id="E1-MJMAIN-2026" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60ZM525 60Q525 84 542 102T585 120Q609 120 627 104T646 61Q646 36 629 18T586 0T543 17T525 60ZM972 60Q972 84 989 102T1032 120Q1056 120 1074 104T1093 61Q1093 36 1076 18T1033 0T990 17T972 60Z"></path><path stroke-width="0" id="E1-MJMATHI-6E" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E1-MJMAIN-31" x="0" y="0"></use><use xlink:href="#E1-MJMAIN-22C5" x="722" y="0"></use><use xlink:href="#E1-MJMAIN-32" x="1222" y="0"></use><use xlink:href="#E1-MJMAIN-22C5" x="1944" y="0"></use><use xlink:href="#E1-MJMAIN-33" x="2444" y="0"></use><use xlink:href="#E1-MJMAIN-22C5" x="3167" y="0"></use><use xlink:href="#E1-MJMAIN-2026" x="3667" y="0"></use><use xlink:href="#E1-MJMAIN-22C5" x="5061" y="0"></use><use xlink:href="#E1-MJMATHI-6E" x="5561" y="0"></use></g></svg></span><script type="math/tex">1\cdot 2\cdot 3\cdot\ldots\cdot n</script><span> 分成长为 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="1.763ex" height="1.877ex" viewBox="0 -755.9 759 808.1" role="img" focusable="false" style="vertical-align: -0.121ex;"><defs><path stroke-width="0" id="E2-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E2-MJMATHI-42" x="0" y="0"></use></g></svg></span><script type="math/tex">B</script><span> 的数段，显然每一段都是形如</span></p><p><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="11.866ex" height="3.278ex" viewBox="0 -1057.4 5109.1 1411.3" role="img" focusable="false" style="vertical-align: -0.822ex;"><defs><path stroke-width="0" id="E3-MJSZ1-220F" d="M158 656Q147 684 131 694Q110 707 69 710H55V750H888V710H874Q840 708 820 698T795 678T786 656V-155Q798 -206 874 -210H888V-250H570V-210H584Q618 -208 638 -197T663 -178T673 -155V710H270V277L271 -155Q283 -206 359 -210H373V-250H55V-210H69Q103 -208 123 -197T148 -178T158 -155V656Z"></path><path stroke-width="0" id="E3-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path><path stroke-width="0" id="E3-MJMATHI-69" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path><path stroke-width="0" id="E3-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path stroke-width="0" id="E3-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path stroke-width="0" id="E3-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E3-MJMATHI-78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path><path stroke-width="0" id="E3-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E3-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E3-MJSZ1-220F" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E3-MJMATHI-42" x="1335" y="674"></use><g transform="translate(944,-286)"><use transform="scale(0.707)" xlink:href="#E3-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E3-MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.707)" xlink:href="#E3-MJMAIN-31" x="1123" y="0"></use></g><use xlink:href="#E3-MJMAIN-28" x="2191" y="0"></use><use xlink:href="#E3-MJMATHI-78" x="2580" y="0"></use><use xlink:href="#E3-MJMAIN-2B" x="3374" y="0"></use><use xlink:href="#E3-MJMATHI-69" x="4375" y="0"></use><use xlink:href="#E3-MJMAIN-29" x="4720" y="0"></use></g></svg></span><script type="math/tex">\prod_{i=1}^B(x+i)</script></p><p><span>的东西，那么多点求值暴力刚出 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="27.199ex" height="2.811ex" viewBox="0 -906.7 11710.6 1210.2" role="img" focusable="false" style="vertical-align: -0.705ex;"><defs><path stroke-width="0" id="E4-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E4-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E4-MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path stroke-width="0" id="E4-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E4-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E4-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path><path stroke-width="0" id="E4-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="0" id="E4-MJMAIN-2E" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E4-MJMATHI-66" x="0" y="0"></use><use xlink:href="#E4-MJMAIN-28" x="550" y="0"></use><use xlink:href="#E4-MJMAIN-30" x="939" y="0"></use><use xlink:href="#E4-MJMAIN-29" x="1439" y="0"></use><use xlink:href="#E4-MJMAIN-2C" x="1828" y="0"></use><use xlink:href="#E4-MJMATHI-66" x="2272" y="0"></use><use xlink:href="#E4-MJMAIN-28" x="2822" y="0"></use><use xlink:href="#E4-MJMATHI-42" x="3211" y="0"></use><use xlink:href="#E4-MJMAIN-29" x="3970" y="0"></use><use xlink:href="#E4-MJMAIN-2C" x="4359" y="0"></use><use xlink:href="#E4-MJMATHI-66" x="4804" y="0"></use><use xlink:href="#E4-MJMAIN-28" x="5354" y="0"></use><use xlink:href="#E4-MJMAIN-32" x="5743" y="0"></use><use xlink:href="#E4-MJMATHI-42" x="6243" y="0"></use><use xlink:href="#E4-MJMAIN-29" x="7002" y="0"></use><use xlink:href="#E4-MJMAIN-2E" x="7391" y="0"></use><use xlink:href="#E4-MJMAIN-2E" x="7836" y="0"></use><use xlink:href="#E4-MJMAIN-2E" x="8280" y="0"></use><use xlink:href="#E4-MJMAIN-2C" x="8725" y="0"></use><use xlink:href="#E4-MJMATHI-66" x="9169" y="0"></use><use xlink:href="#E4-MJMAIN-28" x="9719" y="0"></use><g transform="translate(10108,0)"><use xlink:href="#E4-MJMATHI-42" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E4-MJMAIN-32" x="1073" y="513"></use></g><use xlink:href="#E4-MJMAIN-29" x="11321" y="0"></use></g></svg></span><script type="math/tex">f(0),f(B),f(2B)...,f(B^2)</script><span> 即可，复杂度 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="13.097ex" height="3.044ex" viewBox="0 -956.9 5638.9 1310.7" role="img" focusable="false" style="vertical-align: -0.822ex;"><defs><path stroke-width="0" id="E5-MJMATHI-4F" d="M740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476Z"></path><path stroke-width="0" id="E5-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E5-MJMATHI-6E" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path><path stroke-width="0" id="E5-MJMAIN-221A" d="M95 178Q89 178 81 186T72 200T103 230T169 280T207 309Q209 311 212 311H213Q219 311 227 294T281 177Q300 134 312 108L397 -77Q398 -77 501 136T707 565T814 786Q820 800 834 800Q841 800 846 794T853 782V776L620 293L385 -193Q381 -200 366 -200Q357 -200 354 -197Q352 -195 256 15L160 225L144 214Q129 202 113 190T95 178Z"></path><path stroke-width="0" id="E5-MJMAIN-6C" d="M42 46H56Q95 46 103 60V68Q103 77 103 91T103 124T104 167T104 217T104 272T104 329Q104 366 104 407T104 482T104 542T103 586T103 603Q100 622 89 628T44 637H26V660Q26 683 28 683L38 684Q48 685 67 686T104 688Q121 689 141 690T171 693T182 694H185V379Q185 62 186 60Q190 52 198 49Q219 46 247 46H263V0H255L232 1Q209 2 183 2T145 3T107 3T57 1L34 0H26V46H42Z"></path><path stroke-width="0" id="E5-MJMAIN-6F" d="M28 214Q28 309 93 378T250 448Q340 448 405 380T471 215Q471 120 407 55T250 -10Q153 -10 91 57T28 214ZM250 30Q372 30 372 193V225V250Q372 272 371 288T364 326T348 362T317 390T268 410Q263 411 252 411Q222 411 195 399Q152 377 139 338T126 246V226Q126 130 145 91Q177 30 250 30Z"></path><path stroke-width="0" id="E5-MJMAIN-67" d="M329 409Q373 453 429 453Q459 453 472 434T485 396Q485 382 476 371T449 360Q416 360 412 390Q410 404 415 411Q415 412 416 414V415Q388 412 363 393Q355 388 355 386Q355 385 359 381T368 369T379 351T388 325T392 292Q392 230 343 187T222 143Q172 143 123 171Q112 153 112 133Q112 98 138 81Q147 75 155 75T227 73Q311 72 335 67Q396 58 431 26Q470 -13 470 -72Q470 -139 392 -175Q332 -206 250 -206Q167 -206 107 -175Q29 -140 29 -75Q29 -39 50 -15T92 18L103 24Q67 55 67 108Q67 155 96 193Q52 237 52 292Q52 355 102 398T223 442Q274 442 318 416L329 409ZM299 343Q294 371 273 387T221 404Q192 404 171 388T145 343Q142 326 142 292Q142 248 149 227T179 192Q196 182 222 182Q244 182 260 189T283 207T294 227T299 242Q302 258 302 292T299 343ZM403 -75Q403 -50 389 -34T348 -11T299 -2T245 0H218Q151 0 138 -6Q118 -15 107 -34T95 -74Q95 -84 101 -97T122 -127T170 -155T250 -167Q319 -167 361 -139T403 -75Z"></path><path stroke-width="0" id="E5-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="0" id="E5-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E5-MJMATHI-4F" x="0" y="0"></use><use xlink:href="#E5-MJMAIN-28" x="763" y="0"></use><g transform="translate(1152,0)"><use xlink:href="#E5-MJMAIN-221A" x="0" y="-62"></use><rect stroke="none" width="600" height="60" x="833" y="678"></rect><use xlink:href="#E5-MJMATHI-6E" x="833" y="0"></use></g><g transform="translate(2751,0)"><use xlink:href="#E5-MJMAIN-6C"></use><use xlink:href="#E5-MJMAIN-6F" x="278" y="0"></use><use xlink:href="#E5-MJMAIN-67" x="778" y="0"></use><use transform="scale(0.707)" xlink:href="#E5-MJMAIN-32" x="1807" y="596"></use></g><use xlink:href="#E5-MJMATHI-6E" x="4649" y="0"></use><use xlink:href="#E5-MJMAIN-29" x="5249" y="0"></use></g></svg></span><script type="math/tex">O(\sqrt n\log ^2 n)</script><span>。</span></p><h1><a name="log做法" class="md-header-anchor"></a><span>log做法</span></h1><p><span>我们设</span></p><div contenteditable="false" spellcheck="false" class="mathjax-block md-end-block md-math-block md-rawblock" id="mathjax-n53" cid="n53" mdtype="math_block"><div class="md-rawblock-container md-math-container" tabindex="-1"><div class="MathJax_SVG_Display" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-26-Frame" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="19.502ex" height="7.13ex" viewBox="0 -1811.3 8396.7 3069.8" role="img" focusable="false" style="vertical-align: -2.923ex; max-width: 100%;"><defs><path stroke-width="0" id="E26-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E26-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E26-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E26-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E26-MJMATHI-78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path><path stroke-width="0" id="E26-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E26-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path stroke-width="0" id="E26-MJSZ2-220F" d="M220 812Q220 813 218 819T214 829T208 840T199 853T185 866T166 878T140 887T107 893T66 896H56V950H1221V896H1211Q1080 896 1058 812V-311Q1076 -396 1211 -396H1221V-450H725V-396H735Q864 -396 888 -314Q889 -312 889 -311V896H388V292L389 -311Q405 -396 542 -396H552V-450H56V-396H66Q195 -396 219 -314Q220 -312 220 -311V812Z"></path><path stroke-width="0" id="E26-MJMATHI-69" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path><path stroke-width="0" id="E26-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path stroke-width="0" id="E26-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E26-MJMATHI-66" x="0" y="0"></use><use xlink:href="#E26-MJMAIN-28" x="550" y="0"></use><use xlink:href="#E26-MJMATHI-64" x="939" y="0"></use><use xlink:href="#E26-MJMAIN-2C" x="1462" y="0"></use><use xlink:href="#E26-MJMATHI-78" x="1906" y="0"></use><use xlink:href="#E26-MJMAIN-29" x="2478" y="0"></use><use xlink:href="#E26-MJMAIN-3D" x="3145" y="0"></use><g transform="translate(4201,0)"><use xlink:href="#E26-MJSZ2-220F" x="0" y="0"></use><g transform="translate(65,-1088)"><use transform="scale(0.707)" xlink:href="#E26-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E26-MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.707)" xlink:href="#E26-MJMAIN-31" x="1123" y="0"></use></g><use transform="scale(0.707)" xlink:href="#E26-MJMATHI-64" x="642" y="1626"></use></g><use xlink:href="#E26-MJMAIN-28" x="5479" y="0"></use><use xlink:href="#E26-MJMATHI-78" x="5868" y="0"></use><use xlink:href="#E26-MJMAIN-2B" x="6662" y="0"></use><use xlink:href="#E26-MJMATHI-69" x="7662" y="0"></use><use xlink:href="#E26-MJMAIN-29" x="8007" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-26">f(d,x)=\prod_{i=1}^d(x+i)</script></div></div><p><span>要求的就是 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="39.414ex" height="2.811ex" viewBox="0 -906.7 16969.9 1210.2" role="img" focusable="false" style="vertical-align: -0.705ex;"><defs><path stroke-width="0" id="E7-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E7-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E7-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path><path stroke-width="0" id="E7-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E7-MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path stroke-width="0" id="E7-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E7-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="0" id="E7-MJMAIN-2E" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E7-MJMATHI-66" x="0" y="0"></use><use xlink:href="#E7-MJMAIN-28" x="550" y="0"></use><use xlink:href="#E7-MJMATHI-42" x="939" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="1698" y="0"></use><use xlink:href="#E7-MJMAIN-30" x="2142" y="0"></use><use xlink:href="#E7-MJMAIN-29" x="2642" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="3031" y="0"></use><use xlink:href="#E7-MJMATHI-66" x="3476" y="0"></use><use xlink:href="#E7-MJMAIN-28" x="4026" y="0"></use><use xlink:href="#E7-MJMATHI-42" x="4415" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="5174" y="0"></use><use xlink:href="#E7-MJMATHI-42" x="5619" y="0"></use><use xlink:href="#E7-MJMAIN-29" x="6378" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="6767" y="0"></use><use xlink:href="#E7-MJMATHI-66" x="7211" y="0"></use><use xlink:href="#E7-MJMAIN-28" x="7761" y="0"></use><use xlink:href="#E7-MJMATHI-42" x="8150" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="8909" y="0"></use><use xlink:href="#E7-MJMAIN-32" x="9354" y="0"></use><use xlink:href="#E7-MJMATHI-42" x="9854" y="0"></use><use xlink:href="#E7-MJMAIN-29" x="10613" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="11002" y="0"></use><use xlink:href="#E7-MJMAIN-2E" x="11447" y="0"></use><use xlink:href="#E7-MJMAIN-2E" x="11891" y="0"></use><use xlink:href="#E7-MJMAIN-2E" x="12336" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="12780" y="0"></use><use xlink:href="#E7-MJMATHI-66" x="13225" y="0"></use><use xlink:href="#E7-MJMAIN-28" x="13775" y="0"></use><use xlink:href="#E7-MJMATHI-42" x="14164" y="0"></use><use xlink:href="#E7-MJMAIN-2C" x="14923" y="0"></use><g transform="translate(15368,0)"><use xlink:href="#E7-MJMATHI-42" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E7-MJMAIN-32" x="1073" y="513"></use></g><use xlink:href="#E7-MJMAIN-29" x="16580" y="0"></use></g></svg></span><script type="math/tex">f(B,0),f(B,B),f(B,2B),...,f(B,B^2)</script><span>。</span></p><p><span>那么我们考虑从 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="37.383ex" height="2.577ex" viewBox="0 -806.1 16095.3 1109.7" role="img" focusable="false" style="vertical-align: -0.705ex;"><defs><path stroke-width="0" id="E8-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E8-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E8-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E8-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E8-MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path stroke-width="0" id="E8-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E8-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path><path stroke-width="0" id="E8-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="0" id="E8-MJMAIN-2E" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E8-MJMATHI-66" x="0" y="0"></use><use xlink:href="#E8-MJMAIN-28" x="550" y="0"></use><use xlink:href="#E8-MJMATHI-64" x="939" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="1462" y="0"></use><use xlink:href="#E8-MJMAIN-30" x="1906" y="0"></use><use xlink:href="#E8-MJMAIN-29" x="2406" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="2795" y="0"></use><use xlink:href="#E8-MJMATHI-66" x="3240" y="0"></use><use xlink:href="#E8-MJMAIN-28" x="3790" y="0"></use><use xlink:href="#E8-MJMATHI-64" x="4179" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="4702" y="0"></use><use xlink:href="#E8-MJMATHI-42" x="5147" y="0"></use><use xlink:href="#E8-MJMAIN-29" x="5906" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="6295" y="0"></use><use xlink:href="#E8-MJMATHI-66" x="6739" y="0"></use><use xlink:href="#E8-MJMAIN-28" x="7289" y="0"></use><use xlink:href="#E8-MJMATHI-64" x="7678" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="8201" y="0"></use><use xlink:href="#E8-MJMAIN-32" x="8646" y="0"></use><use xlink:href="#E8-MJMATHI-42" x="9146" y="0"></use><use xlink:href="#E8-MJMAIN-29" x="9905" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="10294" y="0"></use><use xlink:href="#E8-MJMAIN-2E" x="10739" y="0"></use><use xlink:href="#E8-MJMAIN-2E" x="11183" y="0"></use><use xlink:href="#E8-MJMAIN-2E" x="11628" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="12072" y="0"></use><use xlink:href="#E8-MJMATHI-66" x="12517" y="0"></use><use xlink:href="#E8-MJMAIN-28" x="13067" y="0"></use><use xlink:href="#E8-MJMATHI-64" x="13456" y="0"></use><use xlink:href="#E8-MJMAIN-2C" x="13979" y="0"></use><use xlink:href="#E8-MJMATHI-64" x="14424" y="0"></use><use xlink:href="#E8-MJMATHI-42" x="14947" y="0"></use><use xlink:href="#E8-MJMAIN-29" x="15706" y="0"></use></g></svg></span><script type="math/tex">f(d,0),f(d,B),f(d,2B),...,f(d,dB)</script><span> 倍增上去。</span></p><h2><a name="dleftarrow-d1" class="md-header-anchor"></a><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="10.043ex" height="2.012ex" viewBox="0 -749.1 4324 866.1" role="img" focusable="false" style="vertical-align: -0.272ex;"><defs><path stroke-width="0" id="E9-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E9-MJMAIN-2190" d="M944 261T944 250T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H929Q944 261 944 250Z"></path><path stroke-width="0" id="E9-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E9-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E9-MJMATHI-64" x="0" y="0"></use><use xlink:href="#E9-MJMAIN-2190" x="800" y="0"></use><use xlink:href="#E9-MJMATHI-64" x="2078" y="0"></use><use xlink:href="#E9-MJMAIN-2B" x="2823" y="0"></use><use xlink:href="#E9-MJMAIN-31" x="3824" y="0"></use></g></svg></span><script type="math/tex">d\leftarrow d+1</script></h2><p><span>非常简单，</span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="18.117ex" height="2.577ex" viewBox="0 -806.1 7800.6 1109.7" role="img" focusable="false" style="vertical-align: -0.705ex;"><defs><path stroke-width="0" id="E10-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E10-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E10-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E10-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E10-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path stroke-width="0" id="E10-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E10-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E10-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E10-MJMATHI-66" x="0" y="0"></use><use xlink:href="#E10-MJMAIN-28" x="550" y="0"></use><use xlink:href="#E10-MJMATHI-64" x="939" y="0"></use><use xlink:href="#E10-MJMAIN-2B" x="1684" y="0"></use><use xlink:href="#E10-MJMAIN-31" x="2684" y="0"></use><use xlink:href="#E10-MJMAIN-2C" x="3184" y="0"></use><use xlink:href="#E10-MJMAIN-28" x="3629" y="0"></use><use xlink:href="#E10-MJMATHI-64" x="4018" y="0"></use><use xlink:href="#E10-MJMAIN-2B" x="4763" y="0"></use><use xlink:href="#E10-MJMAIN-31" x="5763" y="0"></use><use xlink:href="#E10-MJMAIN-29" x="6263" y="0"></use><use xlink:href="#E10-MJMATHI-42" x="6652" y="0"></use><use xlink:href="#E10-MJMAIN-29" x="7411" y="0"></use></g></svg></span><script type="math/tex">f(d+1,(d+1)B)</script><span> 暴力算，其他的</span></p><div contenteditable="false" spellcheck="false" class="mathjax-block md-end-block md-math-block md-rawblock" id="mathjax-n58" cid="n58" mdtype="math_block"><div class="md-rawblock-container md-math-container" tabindex="-1"><div class="MathJax_SVG_Display" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-27-Frame" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="36.542ex" height="2.577ex" viewBox="0 -806.1 15733.2 1109.7" role="img" focusable="false" style="vertical-align: -0.705ex; max-width: 100%;"><defs><path stroke-width="0" id="E27-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E27-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E27-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E27-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E27-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path stroke-width="0" id="E27-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E27-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path><path stroke-width="0" id="E27-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path><path stroke-width="0" id="E27-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E27-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E27-MJMATHI-66" x="0" y="0"></use><use xlink:href="#E27-MJMAIN-28" x="550" y="0"></use><use xlink:href="#E27-MJMATHI-64" x="939" y="0"></use><use xlink:href="#E27-MJMAIN-2B" x="1684" y="0"></use><use xlink:href="#E27-MJMAIN-31" x="2684" y="0"></use><use xlink:href="#E27-MJMAIN-2C" x="3184" y="0"></use><use xlink:href="#E27-MJMATHI-6B" x="3629" y="0"></use><use xlink:href="#E27-MJMATHI-42" x="4150" y="0"></use><use xlink:href="#E27-MJMAIN-29" x="4909" y="0"></use><use xlink:href="#E27-MJMAIN-3D" x="5575" y="0"></use><use xlink:href="#E27-MJMATHI-66" x="6631" y="0"></use><use xlink:href="#E27-MJMAIN-28" x="7181" y="0"></use><use xlink:href="#E27-MJMATHI-64" x="7570" y="0"></use><use xlink:href="#E27-MJMAIN-2C" x="8093" y="0"></use><use xlink:href="#E27-MJMATHI-6B" x="8538" y="0"></use><use xlink:href="#E27-MJMATHI-42" x="9059" y="0"></use><use xlink:href="#E27-MJMAIN-29" x="9818" y="0"></use><use xlink:href="#E27-MJMAIN-28" x="10207" y="0"></use><use xlink:href="#E27-MJMATHI-6B" x="10596" y="0"></use><use xlink:href="#E27-MJMATHI-42" x="11117" y="0"></use><use xlink:href="#E27-MJMAIN-2B" x="12098" y="0"></use><use xlink:href="#E27-MJMATHI-64" x="13098" y="0"></use><use xlink:href="#E27-MJMAIN-2B" x="13844" y="0"></use><use xlink:href="#E27-MJMAIN-31" x="14844" y="0"></use><use xlink:href="#E27-MJMAIN-29" x="15344" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-27">f(d+1,kB)=f(d,kB)(kB+d+1)</script></div></div><p><span>显然 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="4.794ex" height="2.577ex" viewBox="0 -806.1 2064 1109.7" role="img" focusable="false" style="vertical-align: -0.705ex;"><defs><path stroke-width="0" id="E12-MJMATHI-4F" d="M740 435Q740 320 676 213T511 42T304 -22Q207 -22 138 35T51 201Q50 209 50 244Q50 346 98 438T227 601Q351 704 476 704Q514 704 524 703Q621 689 680 617T740 435ZM637 476Q637 565 591 615T476 665Q396 665 322 605Q242 542 200 428T157 216Q157 126 200 73T314 19Q404 19 485 98T608 313Q637 408 637 476Z"></path><path stroke-width="0" id="E12-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E12-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E12-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E12-MJMATHI-4F" x="0" y="0"></use><use xlink:href="#E12-MJMAIN-28" x="763" y="0"></use><use xlink:href="#E12-MJMATHI-64" x="1152" y="0"></use><use xlink:href="#E12-MJMAIN-29" x="1675" y="0"></use></g></svg></span><script type="math/tex">O(d)</script><span>。</span></p><h2><a name="dleftarrow-2d" class="md-header-anchor"></a><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="7.204ex" height="1.878ex" viewBox="0 -749.1 3101.6 808.6" role="img" focusable="false" style="vertical-align: -0.138ex;"><defs><path stroke-width="0" id="E13-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E13-MJMAIN-2190" d="M944 261T944 250T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H929Q944 261 944 250Z"></path><path stroke-width="0" id="E13-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E13-MJMATHI-64" x="0" y="0"></use><use xlink:href="#E13-MJMAIN-2190" x="800" y="0"></use><use xlink:href="#E13-MJMAIN-32" x="2078" y="0"></use><use xlink:href="#E13-MJMATHI-64" x="2578" y="0"></use></g></svg></span><script type="math/tex">d\leftarrow 2d</script></h2><p><span>我们有</span></p><div contenteditable="false" spellcheck="false" class="mathjax-block md-end-block md-math-block md-rawblock" id="mathjax-n62" cid="n62" mdtype="math_block"><div class="md-rawblock-container md-math-container" tabindex="-1"><div class="MathJax_SVG_Display" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-28-Frame" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="33.227ex" height="2.577ex" viewBox="0 -806.1 14306 1109.7" role="img" focusable="false" style="vertical-align: -0.705ex; max-width: 100%;"><defs><path stroke-width="0" id="E28-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E28-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E28-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="0" id="E28-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E28-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E28-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path><path stroke-width="0" id="E28-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path><path stroke-width="0" id="E28-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E28-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path stroke-width="0" id="E28-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E28-MJMATHI-66" x="0" y="0"></use><use xlink:href="#E28-MJMAIN-28" x="550" y="0"></use><use xlink:href="#E28-MJMAIN-32" x="939" y="0"></use><use xlink:href="#E28-MJMATHI-64" x="1439" y="0"></use><use xlink:href="#E28-MJMAIN-2C" x="1962" y="0"></use><use xlink:href="#E28-MJMATHI-6B" x="2406" y="0"></use><use xlink:href="#E28-MJMATHI-42" x="2927" y="0"></use><use xlink:href="#E28-MJMAIN-29" x="3686" y="0"></use><use xlink:href="#E28-MJMAIN-3D" x="4353" y="0"></use><use xlink:href="#E28-MJMATHI-66" x="5409" y="0"></use><use xlink:href="#E28-MJMAIN-28" x="5959" y="0"></use><use xlink:href="#E28-MJMATHI-64" x="6348" y="0"></use><use xlink:href="#E28-MJMAIN-2C" x="6871" y="0"></use><use xlink:href="#E28-MJMATHI-6B" x="7315" y="0"></use><use xlink:href="#E28-MJMATHI-42" x="7836" y="0"></use><use xlink:href="#E28-MJMAIN-29" x="8595" y="0"></use><use xlink:href="#E28-MJMATHI-66" x="8984" y="0"></use><use xlink:href="#E28-MJMAIN-28" x="9534" y="0"></use><use xlink:href="#E28-MJMATHI-64" x="9923" y="0"></use><use xlink:href="#E28-MJMAIN-2C" x="10446" y="0"></use><use xlink:href="#E28-MJMATHI-6B" x="10891" y="0"></use><use xlink:href="#E28-MJMATHI-42" x="11412" y="0"></use><use xlink:href="#E28-MJMAIN-2B" x="12393" y="0"></use><use xlink:href="#E28-MJMATHI-64" x="13394" y="0"></use><use xlink:href="#E28-MJMAIN-29" x="13917" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-28">f(2d,kB)=f(d,kB)f(d,kB+d)</script></div></div><p><span>大概就是要算这样的一组东西</span></p><p><img src="\images\fac.png" referrerpolicy="no-referrer"></p><p><span>设 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="13.746ex" height="2.577ex" viewBox="0 -806.1 5918.6 1109.7" role="img" focusable="false" style="vertical-align: -0.705ex;"><defs><path stroke-width="0" id="E15-MJMATHI-68" d="M137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683Z"></path><path stroke-width="0" id="E15-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E15-MJMATHI-78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path><path stroke-width="0" id="E15-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E15-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path stroke-width="0" id="E15-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path stroke-width="0" id="E15-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E15-MJMATHI-68" x="0" y="0"></use><use xlink:href="#E15-MJMAIN-28" x="576" y="0"></use><use xlink:href="#E15-MJMATHI-78" x="965" y="0"></use><use xlink:href="#E15-MJMAIN-29" x="1537" y="0"></use><use xlink:href="#E15-MJMAIN-3D" x="2203" y="0"></use><use xlink:href="#E15-MJMATHI-66" x="3259" y="0"></use><use xlink:href="#E15-MJMAIN-28" x="3809" y="0"></use><use xlink:href="#E15-MJMATHI-42" x="4198" y="0"></use><use xlink:href="#E15-MJMATHI-78" x="4957" y="0"></use><use xlink:href="#E15-MJMAIN-29" x="5529" y="0"></use></g></svg></span><script type="math/tex">h(x)=f(Bx)</script><span>，那么其实就是要求两次</span></p><div contenteditable="false" spellcheck="false" class="mathjax-block md-end-block md-math-block md-rawblock" id="mathjax-n66" cid="n66" mdtype="math_block"><div class="md-rawblock-container md-math-container" tabindex="-1"><div class="MathJax_SVG_Display" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-29-Frame" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="27.316ex" height="2.577ex" viewBox="0 -806.1 11760.9 1109.7" role="img" focusable="false" style="vertical-align: -0.705ex; max-width: 100%;"><defs><path stroke-width="0" id="E29-MJMATHI-68" d="M137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683Z"></path><path stroke-width="0" id="E29-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E29-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path><path stroke-width="0" id="E29-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E29-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path stroke-width="0" id="E29-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E29-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path stroke-width="0" id="E29-MJMAIN-2E" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z"></path><path stroke-width="0" id="E29-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E29-MJMATHI-68" x="0" y="0"></use><use xlink:href="#E29-MJMAIN-28" x="576" y="0"></use><use xlink:href="#E29-MJMATHI-6B" x="965" y="0"></use><use xlink:href="#E29-MJMAIN-29" x="1486" y="0"></use><use xlink:href="#E29-MJMAIN-2C" x="1875" y="0"></use><use xlink:href="#E29-MJMATHI-68" x="2319" y="0"></use><use xlink:href="#E29-MJMAIN-28" x="2895" y="0"></use><use xlink:href="#E29-MJMATHI-6B" x="3284" y="0"></use><use xlink:href="#E29-MJMAIN-2B" x="4027" y="0"></use><use xlink:href="#E29-MJMAIN-31" x="5028" y="0"></use><use xlink:href="#E29-MJMAIN-29" x="5528" y="0"></use><use xlink:href="#E29-MJMAIN-2C" x="5917" y="0"></use><use xlink:href="#E29-MJMAIN-2E" x="6361" y="0"></use><use xlink:href="#E29-MJMAIN-2E" x="6806" y="0"></use><use xlink:href="#E29-MJMAIN-2E" x="7251" y="0"></use><use xlink:href="#E29-MJMAIN-2C" x="7695" y="0"></use><use xlink:href="#E29-MJMATHI-68" x="8140" y="0"></use><use xlink:href="#E29-MJMAIN-28" x="8716" y="0"></use><use xlink:href="#E29-MJMATHI-6B" x="9105" y="0"></use><use xlink:href="#E29-MJMAIN-2B" x="9848" y="0"></use><use xlink:href="#E29-MJMATHI-64" x="10848" y="0"></use><use xlink:href="#E29-MJMAIN-29" x="11371" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-29">h(k),h(k+1),...,h(k+d)</script></div></div><p><span>具体来讲就是 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="9.523ex" height="2.11ex" viewBox="0 -755.9 4100 908.7" role="img" focusable="false" style="vertical-align: -0.355ex;"><defs><path stroke-width="0" id="E17-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path><path stroke-width="0" id="E17-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path stroke-width="0" id="E17-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E17-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E17-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E17-MJMATHI-6B" x="0" y="0"></use><use xlink:href="#E17-MJMAIN-3D" x="798" y="0"></use><use xlink:href="#E17-MJMATHI-64" x="1854" y="0"></use><use xlink:href="#E17-MJMAIN-2B" x="2599" y="0"></use><use xlink:href="#E17-MJMAIN-31" x="3600" y="0"></use></g></svg></span><script type="math/tex">k=d+1</script><span> 和 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="2.599ex" height="5.145ex" viewBox="0 -1459.5 1119 2215.4" role="img" focusable="false" style="vertical-align: -1.756ex;"><defs><path stroke-width="0" id="E18-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E18-MJMATHI-42" d="M231 637Q204 637 199 638T194 649Q194 676 205 682Q206 683 335 683Q594 683 608 681Q671 671 713 636T756 544Q756 480 698 429T565 360L555 357Q619 348 660 311T702 219Q702 146 630 78T453 1Q446 0 242 0Q42 0 39 2Q35 5 35 10Q35 17 37 24Q42 43 47 45Q51 46 62 46H68Q95 46 128 49Q142 52 147 61Q150 65 219 339T288 628Q288 635 231 637ZM649 544Q649 574 634 600T585 634Q578 636 493 637Q473 637 451 637T416 636H403Q388 635 384 626Q382 622 352 506Q352 503 351 500L320 374H401Q482 374 494 376Q554 386 601 434T649 544ZM595 229Q595 273 572 302T512 336Q506 337 429 337Q311 337 310 336Q310 334 293 263T258 122L240 52Q240 48 252 48T333 46Q422 46 429 47Q491 54 543 105T595 229Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(120,0)"><rect stroke="none" width="879" height="60" x="0" y="220"></rect><use xlink:href="#E18-MJMATHI-64" x="178" y="676"></use><use xlink:href="#E18-MJMATHI-42" x="60" y="-686"></use></g></g></svg></span><script type="math/tex">\dfrac{d}{B}</script><span>。</span></p><p><span>拉格朗日插一插</span><del><span>叉义叉</span></del><span>得到</span></p><div contenteditable="false" spellcheck="false" class="mathjax-block md-end-block md-math-block md-rawblock" id="mathjax-n69" cid="n69" mdtype="math_block"><div class="md-rawblock-container md-math-container" tabindex="-1"><div class="MathJax_SVG_Display" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-30-Frame" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="32.845ex" height="7.714ex" viewBox="0 -1811.3 14141.3 3321.1" role="img" focusable="false" style="vertical-align: -3.507ex; max-width: 100%;"><defs><path stroke-width="0" id="E30-MJMATHI-68" d="M137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683Z"></path><path stroke-width="0" id="E30-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E30-MJMATHI-6A" d="M297 596Q297 627 318 644T361 661Q378 661 389 651T403 623Q403 595 384 576T340 557Q322 557 310 567T297 596ZM288 376Q288 405 262 405Q240 405 220 393T185 362T161 325T144 293L137 279Q135 278 121 278H107Q101 284 101 286T105 299Q126 348 164 391T252 441Q253 441 260 441T272 442Q296 441 316 432Q341 418 354 401T367 348V332L318 133Q267 -67 264 -75Q246 -125 194 -164T75 -204Q25 -204 7 -183T-12 -137Q-12 -110 7 -91T53 -71Q70 -71 82 -81T95 -112Q95 -148 63 -167Q69 -168 77 -168Q111 -168 139 -140T182 -74L193 -32Q204 11 219 72T251 197T278 308T289 365Q289 372 288 376Z"></path><path stroke-width="0" id="E30-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E30-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path><path stroke-width="0" id="E30-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E30-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path stroke-width="0" id="E30-MJSZ2-2211" d="M60 948Q63 950 665 950H1267L1325 815Q1384 677 1388 669H1348L1341 683Q1320 724 1285 761Q1235 809 1174 838T1033 881T882 898T699 902H574H543H251L259 891Q722 258 724 252Q725 250 724 246Q721 243 460 -56L196 -356Q196 -357 407 -357Q459 -357 548 -357T676 -358Q812 -358 896 -353T1063 -332T1204 -283T1307 -196Q1328 -170 1348 -124H1388Q1388 -125 1381 -145T1356 -210T1325 -294L1267 -449L666 -450Q64 -450 61 -448Q55 -446 55 -439Q55 -437 57 -433L590 177Q590 178 557 222T452 366T322 544L56 909L55 924Q55 945 60 948Z"></path><path stroke-width="0" id="E30-MJMATHI-69" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path><path stroke-width="0" id="E30-MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path stroke-width="0" id="E30-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E30-MJSZ2-220F" d="M220 812Q220 813 218 819T214 829T208 840T199 853T185 866T166 878T140 887T107 893T66 896H56V950H1221V896H1211Q1080 896 1058 812V-311Q1076 -396 1211 -396H1221V-450H725V-396H735Q864 -396 888 -314Q889 -312 889 -311V896H388V292L389 -311Q405 -396 542 -396H552V-450H56V-396H66Q195 -396 219 -314Q220 -312 220 -311V812Z"></path><path stroke-width="0" id="E30-MJMAIN-2032" d="M79 43Q73 43 52 49T30 61Q30 68 85 293T146 528Q161 560 198 560Q218 560 240 545T262 501Q262 496 260 486Q259 479 173 263T84 45T79 43Z"></path><path stroke-width="0" id="E30-MJMAIN-2260" d="M166 -215T159 -215T147 -212T141 -204T139 -197Q139 -190 144 -183L306 133H70Q56 140 56 153Q56 168 72 173H327L406 327H72Q56 332 56 347Q56 360 70 367H426Q597 702 602 707Q605 716 618 716Q625 716 630 712T636 703T638 696Q638 692 471 367H707Q722 359 722 347Q722 336 708 328L451 327L371 173H708Q722 163 722 153Q722 140 707 133H351Q175 -210 170 -212Q166 -215 159 -215Z"></path><path stroke-width="0" id="E30-MJMAIN-2212" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E30-MJMATHI-68" x="0" y="0"></use><use xlink:href="#E30-MJMAIN-28" x="576" y="0"></use><use xlink:href="#E30-MJMATHI-6A" x="965" y="0"></use><use xlink:href="#E30-MJMAIN-2B" x="1599" y="0"></use><use xlink:href="#E30-MJMATHI-6B" x="2599" y="0"></use><use xlink:href="#E30-MJMAIN-29" x="3120" y="0"></use><use xlink:href="#E30-MJMAIN-3D" x="3787" y="0"></use><g transform="translate(4843,0)"><use xlink:href="#E30-MJSZ2-2211" x="0" y="0"></use><g transform="translate(148,-1088)"><use transform="scale(0.707)" xlink:href="#E30-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E30-MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.707)" xlink:href="#E30-MJMAIN-30" x="1123" y="0"></use></g><use transform="scale(0.707)" xlink:href="#E30-MJMATHI-64" x="759" y="1626"></use></g><use xlink:href="#E30-MJMATHI-68" x="6453" y="0"></use><use xlink:href="#E30-MJMAIN-28" x="7029" y="0"></use><use xlink:href="#E30-MJMATHI-69" x="7418" y="0"></use><use xlink:href="#E30-MJMAIN-29" x="7763" y="0"></use><g transform="translate(8319,0)"><use xlink:href="#E30-MJSZ2-220F" x="0" y="0"></use><g transform="translate(15,-1172)"><use transform="scale(0.707)" xlink:href="#E30-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.5)" xlink:href="#E30-MJMAIN-2032" x="487" y="548"></use><use transform="scale(0.707)" xlink:href="#E30-MJMAIN-2260" x="639" y="0"></use><use transform="scale(0.707)" xlink:href="#E30-MJMATHI-69" x="1417" y="0"></use></g></g><g transform="translate(9764,0)"><g transform="translate(120,0)"><rect stroke="none" width="4137" height="60" x="0" y="220"></rect><g transform="translate(60,676)"><use xlink:href="#E30-MJMATHI-6A" x="0" y="0"></use><use xlink:href="#E30-MJMAIN-2B" x="634" y="0"></use><use xlink:href="#E30-MJMATHI-6B" x="1634" y="0"></use><use xlink:href="#E30-MJMAIN-2212" x="2377" y="0"></use><g transform="translate(3377,0)"><use xlink:href="#E30-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E30-MJMAIN-2032" x="487" y="513"></use></g></g><g transform="translate(965,-686)"><use xlink:href="#E30-MJMATHI-69" x="0" y="0"></use><use xlink:href="#E30-MJMAIN-2212" x="567" y="0"></use><g transform="translate(1567,0)"><use xlink:href="#E30-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E30-MJMAIN-2032" x="487" y="408"></use></g></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-30">h(j+k)=\sum_{i=0}^dh(i)\prod_{i'\neq i}\dfrac{j+k-i'}{i-i'}</script></div></div><div contenteditable="false" spellcheck="false" class="mathjax-block md-end-block md-math-block md-rawblock md-focus" id="mathjax-n70" cid="n70" mdtype="math_block"><div class="md-rawblock-container md-math-container" contenteditable="false" tabindex="-1">
						<div class="MathJax_SVG_Display" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-25-Frame" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="55.583ex" height="7.13ex" viewBox="0 -1811.3 23931.5 3069.8" role="img" focusable="false" style="vertical-align: -2.923ex; max-width: 100%;"><defs><path stroke-width="0" id="E31-MJMATHI-68" d="M137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683Z"></path><path stroke-width="0" id="E31-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path stroke-width="0" id="E31-MJMATHI-6A" d="M297 596Q297 627 318 644T361 661Q378 661 389 651T403 623Q403 595 384 576T340 557Q322 557 310 567T297 596ZM288 376Q288 405 262 405Q240 405 220 393T185 362T161 325T144 293L137 279Q135 278 121 278H107Q101 284 101 286T105 299Q126 348 164 391T252 441Q253 441 260 441T272 442Q296 441 316 432Q341 418 354 401T367 348V332L318 133Q267 -67 264 -75Q246 -125 194 -164T75 -204Q25 -204 7 -183T-12 -137Q-12 -110 7 -91T53 -71Q70 -71 82 -81T95 -112Q95 -148 63 -167Q69 -168 77 -168Q111 -168 139 -140T182 -74L193 -32Q204 11 219 72T251 197T278 308T289 365Q289 372 288 376Z"></path><path stroke-width="0" id="E31-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E31-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path><path stroke-width="0" id="E31-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path stroke-width="0" id="E31-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path stroke-width="0" id="E31-MJSZ2-220F" d="M220 812Q220 813 218 819T214 829T208 840T199 853T185 866T166 878T140 887T107 893T66 896H56V950H1221V896H1211Q1080 896 1058 812V-311Q1076 -396 1211 -396H1221V-450H725V-396H735Q864 -396 888 -314Q889 -312 889 -311V896H388V292L389 -311Q405 -396 542 -396H552V-450H56V-396H66Q195 -396 219 -314Q220 -312 220 -311V812Z"></path><path stroke-width="0" id="E31-MJMATHI-69" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path><path stroke-width="0" id="E31-MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path stroke-width="0" id="E31-MJMATHI-64" d="M366 683Q367 683 438 688T511 694Q523 694 523 686Q523 679 450 384T375 83T374 68Q374 26 402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487H491Q506 153 506 145Q506 140 503 129Q490 79 473 48T445 8T417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157Q33 205 53 255T101 341Q148 398 195 420T280 442Q336 442 364 400Q369 394 369 396Q370 400 396 505T424 616Q424 629 417 632T378 637H357Q351 643 351 645T353 664Q358 683 366 683ZM352 326Q329 405 277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q233 26 290 98L298 109L352 326Z"></path><path stroke-width="0" id="E31-MJMAIN-2212" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path><path stroke-width="0" id="E31-MJSZ2-2211" d="M60 948Q63 950 665 950H1267L1325 815Q1384 677 1388 669H1348L1341 683Q1320 724 1285 761Q1235 809 1174 838T1033 881T882 898T699 902H574H543H251L259 891Q722 258 724 252Q725 250 724 246Q721 243 460 -56L196 -356Q196 -357 407 -357Q459 -357 548 -357T676 -358Q812 -358 896 -353T1063 -332T1204 -283T1307 -196Q1328 -170 1348 -124H1388Q1388 -125 1381 -145T1356 -210T1325 -294L1267 -449L666 -450Q64 -450 61 -448Q55 -446 55 -439Q55 -437 57 -433L590 177Q590 178 557 222T452 366T322 544L56 909L55 924Q55 945 60 948Z"></path><path stroke-width="0" id="E31-MJMAIN-21" d="M78 661Q78 682 96 699T138 716T180 700T199 661Q199 654 179 432T158 206Q156 198 139 198Q121 198 119 206Q118 209 98 431T78 661ZM79 61Q79 89 97 105T141 121Q164 119 181 104T198 61Q198 31 181 16T139 1Q114 1 97 16T79 61Z"></path><path stroke-width="0" id="E31-MJMAIN-31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E31-MJMATHI-68" x="0" y="0"></use><use xlink:href="#E31-MJMAIN-28" x="576" y="0"></use><use xlink:href="#E31-MJMATHI-6A" x="965" y="0"></use><use xlink:href="#E31-MJMAIN-2B" x="1599" y="0"></use><use xlink:href="#E31-MJMATHI-6B" x="2599" y="0"></use><use xlink:href="#E31-MJMAIN-29" x="3120" y="0"></use><use xlink:href="#E31-MJMAIN-3D" x="3787" y="0"></use><g transform="translate(4843,0)"><use xlink:href="#E31-MJSZ2-220F" x="0" y="0"></use><g transform="translate(65,-1088)"><use transform="scale(0.707)" xlink:href="#E31-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E31-MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.707)" xlink:href="#E31-MJMAIN-30" x="1123" y="0"></use></g><use transform="scale(0.707)" xlink:href="#E31-MJMATHI-64" x="642" y="1626"></use></g><use xlink:href="#E31-MJMAIN-28" x="6121" y="0"></use><use xlink:href="#E31-MJMATHI-6A" x="6510" y="0"></use><use xlink:href="#E31-MJMAIN-2B" x="7144" y="0"></use><use xlink:href="#E31-MJMATHI-6B" x="8144" y="0"></use><use xlink:href="#E31-MJMAIN-2212" x="8887" y="0"></use><use xlink:href="#E31-MJMATHI-69" x="9887" y="0"></use><use xlink:href="#E31-MJMAIN-29" x="10232" y="0"></use><g transform="translate(10788,0)"><use xlink:href="#E31-MJSZ2-2211" x="0" y="0"></use><g transform="translate(148,-1088)"><use transform="scale(0.707)" xlink:href="#E31-MJMATHI-69" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E31-MJMAIN-3D" x="345" y="0"></use><use transform="scale(0.707)" xlink:href="#E31-MJMAIN-30" x="1123" y="0"></use></g><use transform="scale(0.707)" xlink:href="#E31-MJMATHI-64" x="759" y="1626"></use></g><g transform="translate(12399,0)"><g transform="translate(120,0)"><rect stroke="none" width="7209" height="60" x="0" y="220"></rect><g transform="translate(2755,715)"><use xlink:href="#E31-MJMATHI-68" x="0" y="0"></use><use xlink:href="#E31-MJMAIN-28" x="576" y="0"></use><use xlink:href="#E31-MJMATHI-69" x="965" y="0"></use><use xlink:href="#E31-MJMAIN-29" x="1310" y="0"></use></g><g transform="translate(60,-746)"><use xlink:href="#E31-MJMATHI-69" x="0" y="0"></use><use xlink:href="#E31-MJMAIN-21" x="345" y="0"></use><use xlink:href="#E31-MJMAIN-28" x="623" y="0"></use><use xlink:href="#E31-MJMATHI-64" x="1012" y="0"></use><use xlink:href="#E31-MJMAIN-2212" x="1757" y="0"></use><use xlink:href="#E31-MJMATHI-69" x="2757" y="0"></use><use xlink:href="#E31-MJMAIN-29" x="3102" y="0"></use><use xlink:href="#E31-MJMAIN-21" x="3491" y="0"></use><use xlink:href="#E31-MJMAIN-28" x="3769" y="0"></use><use xlink:href="#E31-MJMAIN-2212" x="4158" y="0"></use><use xlink:href="#E31-MJMAIN-31" x="4936" y="0"></use><g transform="translate(5436,0)"><use xlink:href="#E31-MJMAIN-29" x="0" y="0"></use><g transform="translate(389,288)"><use transform="scale(0.707)" xlink:href="#E31-MJMATHI-64" x="0" y="0"></use><use transform="scale(0.707)" xlink:href="#E31-MJMAIN-2212" x="523" y="0"></use><use transform="scale(0.707)" xlink:href="#E31-MJMATHI-69" x="1301" y="0"></use></g></g></g></g></g><g transform="translate(19848,0)"><g transform="translate(120,0)"><rect stroke="none" width="3842" height="60" x="0" y="220"></rect><use xlink:href="#E31-MJMAIN-31" x="1671" y="676"></use><g transform="translate(60,-686)"><use xlink:href="#E31-MJMATHI-6A" x="0" y="0"></use><use xlink:href="#E31-MJMAIN-2B" x="634" y="0"></use><use xlink:href="#E31-MJMATHI-6B" x="1634" y="0"></use><use xlink:href="#E31-MJMAIN-2212" x="2377" y="0"></use><use xlink:href="#E31-MJMATHI-69" x="3377" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-25">h(j+k)=\prod_{i=0}^d(j+k-i)\sum_{i=0}^d\dfrac{h(i)}{i!(d-i)!(-1)^{d-i}}\dfrac{1}{j+k-i}</script>
					</div></div><p><span>前面那个双指针，后面那个卷积即可。注意 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="1.21ex" height="1.994ex" viewBox="0 -755.9 521 858.4" role="img" focusable="false" style="vertical-align: -0.238ex;"><defs><path stroke-width="0" id="E21-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E21-MJMATHI-6B" x="0" y="0"></use></g></svg></span><script type="math/tex">k</script><span> 可能不是整数所以 </span><span class="MathJax_SVG" tabindex="-1" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="5.034ex" height="2.461ex" viewBox="-12 -755.9 2167.4 1059.4" role="img" focusable="false" style="vertical-align: -0.705ex; margin-left: -0.028ex;"><defs><path stroke-width="0" id="E22-MJMATHI-6A" d="M297 596Q297 627 318 644T361 661Q378 661 389 651T403 623Q403 595 384 576T340 557Q322 557 310 567T297 596ZM288 376Q288 405 262 405Q240 405 220 393T185 362T161 325T144 293L137 279Q135 278 121 278H107Q101 284 101 286T105 299Q126 348 164 391T252 441Q253 441 260 441T272 442Q296 441 316 432Q341 418 354 401T367 348V332L318 133Q267 -67 264 -75Q246 -125 194 -164T75 -204Q25 -204 7 -183T-12 -137Q-12 -110 7 -91T53 -71Q70 -71 82 -81T95 -112Q95 -148 63 -167Q69 -168 77 -168Q111 -168 139 -140T182 -74L193 -32Q204 11 219 72T251 197T278 308T289 365Q289 372 288 376Z"></path><path stroke-width="0" id="E22-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="0" id="E22-MJMATHI-6B" d="M121 647Q121 657 125 670T137 683Q138 683 209 688T282 694Q294 694 294 686Q294 679 244 477Q194 279 194 272Q213 282 223 291Q247 309 292 354T362 415Q402 442 438 442Q468 442 485 423T503 369Q503 344 496 327T477 302T456 291T438 288Q418 288 406 299T394 328Q394 353 410 369T442 390L458 393Q446 405 434 405H430Q398 402 367 380T294 316T228 255Q230 254 243 252T267 246T293 238T320 224T342 206T359 180T365 147Q365 130 360 106T354 66Q354 26 381 26Q429 26 459 145Q461 153 479 153H483Q499 153 499 144Q499 139 496 130Q455 -11 378 -11Q333 -11 305 15T277 90Q277 108 280 121T283 145Q283 167 269 183T234 206T200 217T182 220H180Q168 178 159 139T145 81T136 44T129 20T122 7T111 -2Q98 -11 83 -11Q66 -11 57 -1T48 16Q48 26 85 176T158 471L195 616Q196 629 188 632T149 637H144Q134 637 131 637T124 640T121 647Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use xlink:href="#E22-MJMATHI-6A" x="0" y="0"></use><use xlink:href="#E22-MJMAIN-2B" x="634" y="0"></use><use xlink:href="#E22-MJMATHI-6B" x="1634" y="0"></use></g></svg></span><script type="math/tex">j+k</script><span> 可能巨大无比，卷积时注意移位。</span></p><h2><a name="后记" class="md-header-anchor"></a><span>后记</span></h2><ul><li><a href='https://www.luogu.com.cn/problem/P5282'><span>P5282 【模板】快速阶乘算法</span></a></li></ul><p><span>这题其实坠痛苦的是任意模数……</span></p><p><span>相信不会有神必出题人在 OI 赛场上出题不用 998244353 还不放 7 次的拆系数 FFT 过的吧，呐？</span></p><p><span>参考代码，不开 O2 过不了：</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="cpp" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="cpp"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#include&lt;bits/stdc++.h&gt;</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#define ll long long</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#define int long long</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#define db long double</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-keyword">namespace</span> <span class="cm-def">std</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">const</span> <span class="cm-variable-3">int</span> <span class="cm-variable">maxN</span><span class="cm-operator">=</span><span class="cm-number">262144</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">const</span> <span class="cm-variable">db</span> <span class="cm-variable">Pi</span><span class="cm-operator">=</span><span class="cm-variable">acos</span>(<span class="cm-operator">-</span><span class="cm-number">1</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">struct</span> <span class="cm-def">Cpl</span>{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">db</span> <span class="cm-variable">r</span>,<span class="cm-variable">i</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">Cpl</span>(<span class="cm-variable">db</span> <span class="cm-variable">r0</span><span class="cm-operator">=</span><span class="cm-number">0</span>,<span class="cm-variable">db</span> <span class="cm-variable">i0</span><span class="cm-operator">=</span><span class="cm-number">0</span>){<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">r0</span>;<span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-variable">i0</span>;}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">Cpl</span> <span class="cm-keyword">operator</span> <span class="cm-operator">+</span>(<span class="cm-keyword">const</span> <span class="cm-variable">Cpl</span> <span class="cm-variable">b</span>)<span class="cm-keyword">const</span>{<span class="cm-keyword">return</span> <span class="cm-variable">Cpl</span>(<span class="cm-variable">r</span><span class="cm-operator">+</span><span class="cm-variable">b</span>.<span class="cm-variable">r</span>,<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-variable">b</span>.<span class="cm-variable">i</span>);}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">Cpl</span> <span class="cm-keyword">operator</span> <span class="cm-operator">-</span>(<span class="cm-keyword">const</span> <span class="cm-variable">Cpl</span> <span class="cm-variable">b</span>)<span class="cm-keyword">const</span>{<span class="cm-keyword">return</span> <span class="cm-variable">Cpl</span>(<span class="cm-variable">r</span><span class="cm-operator">-</span><span class="cm-variable">b</span>.<span class="cm-variable">r</span>,<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-variable">b</span>.<span class="cm-variable">i</span>);}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">Cpl</span> <span class="cm-keyword">operator</span> <span class="cm-operator">*</span>(<span class="cm-keyword">const</span> <span class="cm-variable">Cpl</span> <span class="cm-variable">b</span>)<span class="cm-keyword">const</span>{<span class="cm-keyword">return</span> <span class="cm-variable">Cpl</span>(<span class="cm-variable">r</span><span class="cm-operator">*</span><span class="cm-variable">b</span>.<span class="cm-variable">r</span><span class="cm-operator">-</span><span class="cm-variable">i</span><span class="cm-operator">*</span><span class="cm-variable">b</span>.<span class="cm-variable">i</span>,<span class="cm-variable">r</span><span class="cm-operator">*</span><span class="cm-variable">b</span>.<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-variable">i</span><span class="cm-operator">*</span><span class="cm-variable">b</span>.<span class="cm-variable">r</span>);}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable-3">bool</span> <span class="cm-keyword">operator</span> <span class="cm-operator">==</span>(<span class="cm-keyword">const</span> <span class="cm-variable">Cpl</span> <span class="cm-variable">b</span>)<span class="cm-keyword">const</span>{<span class="cm-keyword">return</span> <span class="cm-variable">abs</span>(<span class="cm-variable">r</span><span class="cm-operator">-</span><span class="cm-variable">b</span>.<span class="cm-variable">r</span>)<span class="cm-operator">&lt;</span><span class="cm-number">1e</span><span class="cm-operator">-</span><span class="cm-number">8</span><span class="cm-operator">&amp;&amp;</span><span class="cm-variable">abs</span>(<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-variable">b</span>.<span class="cm-variable">i</span>)<span class="cm-operator">&lt;</span><span class="cm-number">1e</span><span class="cm-operator">-</span><span class="cm-number">8</span>;}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}<span class="cm-variable">W</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">iW</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">R</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">FFT</span>(<span class="cm-variable">Cpl</span> <span class="cm-variable">d</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">n0</span>,<span class="cm-variable-3">bool</span> <span class="cm-variable">flg</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable-3">int</span> <span class="cm-variable">x</span><span class="cm-operator">=</span><span class="cm-number">1</span>,<span class="cm-variable">len</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-keyword">while</span>(<span class="cm-variable">x</span><span class="cm-operator">&lt;</span><span class="cm-variable">n0</span>) <span class="cm-variable">x</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>,<span class="cm-variable">len</span><span class="cm-operator">++</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">R</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span>(<span class="cm-variable">R</span>[<span class="cm-variable">i</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>]<span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>)<span class="cm-operator">|</span>((<span class="cm-variable">i</span><span class="cm-operator">&amp;</span><span class="cm-number">1</span>)<span class="cm-operator">&lt;&lt;</span>(<span class="cm-variable">len</span><span class="cm-operator">-</span><span class="cm-number">1</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span>(<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">R</span>[<span class="cm-variable">i</span>]) <span class="cm-variable">swap</span>(<span class="cm-variable">d</span>[<span class="cm-variable">i</span>],<span class="cm-variable">d</span>[<span class="cm-variable">R</span>[<span class="cm-variable">i</span>]]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>,<span class="cm-variable">l</span><span class="cm-operator">=</span><span class="cm-variable">maxN</span><span class="cm-operator">/</span>(<span class="cm-variable">i</span><span class="cm-operator">&lt;&lt;</span><span class="cm-number">1</span>);<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>,<span class="cm-variable">l</span><span class="cm-operator">&gt;&gt;=</span><span class="cm-number">1</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">j</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">j</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">j</span><span class="cm-operator">+=</span>(<span class="cm-variable">i</span><span class="cm-operator">&lt;&lt;</span><span class="cm-number">1</span>))</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">k</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">k</span><span class="cm-operator">&lt;</span><span class="cm-variable">i</span>;<span class="cm-variable">k</span><span class="cm-operator">++</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Cpl</span> <span class="cm-variable">a0</span><span class="cm-operator">=</span><span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">+</span><span class="cm-variable">k</span>],<span class="cm-variable">a1</span><span class="cm-operator">=</span>(<span class="cm-variable">flg</span><span class="cm-operator">?</span><span class="cm-variable">iW</span>[<span class="cm-variable">l</span><span class="cm-operator">*</span><span class="cm-variable">k</span>]:<span class="cm-variable">W</span>[<span class="cm-variable">l</span><span class="cm-operator">*</span><span class="cm-variable">k</span>])<span class="cm-operator">*</span><span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">+</span><span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-variable">k</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">+</span><span class="cm-variable">k</span>]<span class="cm-operator">=</span><span class="cm-variable">a0</span><span class="cm-operator">+</span><span class="cm-variable">a1</span>;<span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">+</span><span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-variable">k</span>]<span class="cm-operator">=</span><span class="cm-variable">a0</span><span class="cm-operator">-</span><span class="cm-variable">a1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">if</span>(<span class="cm-variable">flg</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">d</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">/=</span><span class="cm-variable">x</span>,<span class="cm-variable">d</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span><span class="cm-operator">/=</span><span class="cm-variable">x</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">Cpl</span> <span class="cm-variable">tp</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">tq</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">Cpl</span> <span class="cm-variable">d1</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">d2</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">dbFFT</span>(<span class="cm-variable">Cpl</span> <span class="cm-variable">d1</span>[],<span class="cm-variable">Cpl</span> <span class="cm-variable">d2</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">n0</span>,<span class="cm-variable-3">bool</span> <span class="cm-variable">flg</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">n0</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">tp</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">d1</span>[<span class="cm-variable">i</span>]<span class="cm-operator">+</span><span class="cm-variable">Cpl</span>(<span class="cm-number">0</span>,<span class="cm-number">1</span>)<span class="cm-operator">*</span><span class="cm-variable">d2</span>[<span class="cm-variable">i</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">FFT</span>(<span class="cm-variable">tp</span>,<span class="cm-variable">n0</span>,<span class="cm-variable">flg</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">n0</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">tq</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">Cpl</span>(<span class="cm-variable">tp</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span>,<span class="cm-operator">-</span><span class="cm-variable">tp</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">reverse</span>(<span class="cm-variable">tq</span><span class="cm-operator">+</span><span class="cm-number">1</span>,<span class="cm-variable">tq</span><span class="cm-operator">+</span><span class="cm-variable">n0</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">n0</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">d1</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span>(<span class="cm-variable">tp</span>[<span class="cm-variable">i</span>]<span class="cm-operator">+</span><span class="cm-variable">tq</span>[<span class="cm-variable">i</span>])<span class="cm-operator">*</span><span class="cm-variable">Cpl</span>(<span class="cm-number">0.5</span>,<span class="cm-number">0</span>),<span class="cm-variable">d2</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span>(<span class="cm-variable">tp</span>[<span class="cm-variable">i</span>]<span class="cm-operator">-</span><span class="cm-variable">tq</span>[<span class="cm-variable">i</span>])<span class="cm-operator">*</span><span class="cm-variable">Cpl</span>(<span class="cm-number">0</span>,<span class="cm-operator">-</span><span class="cm-number">0.5</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">Cpl</span> <span class="cm-variable">a1</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">b1</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">a0</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">b0</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">c1</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">c2</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">Conv</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">A</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">B</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">ans</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">n0</span>,<span class="cm-variable-3">int</span> <span class="cm-variable">p</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable-3">int</span> <span class="cm-variable">x</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-keyword">while</span>(<span class="cm-variable">x</span><span class="cm-operator">&lt;</span>(<span class="cm-variable">n0</span><span class="cm-operator">&lt;&lt;</span><span class="cm-number">1</span>)) <span class="cm-variable">x</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">a1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">A</span>[<span class="cm-variable">i</span>]<span class="cm-operator">&gt;&gt;</span><span class="cm-number">15</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">b1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">B</span>[<span class="cm-variable">i</span>]<span class="cm-operator">&gt;&gt;</span><span class="cm-number">15</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">a0</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">A</span>[<span class="cm-variable">i</span>]<span class="cm-operator">&amp;</span><span class="cm-number">0x7fff</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">b0</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">B</span>[<span class="cm-variable">i</span>]<span class="cm-operator">&amp;</span><span class="cm-number">0x7fff</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">dbFFT</span>(<span class="cm-variable">a1</span>,<span class="cm-variable">b1</span>,<span class="cm-variable">x</span>,<span class="cm-number">0</span>);<span class="cm-variable">dbFFT</span>(<span class="cm-variable">a0</span>,<span class="cm-variable">b0</span>,<span class="cm-variable">x</span>,<span class="cm-number">0</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">c1</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">a1</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">b1</span>[<span class="cm-variable">i</span>],</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">c2</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">a1</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">b0</span>[<span class="cm-variable">i</span>]<span class="cm-operator">+</span><span class="cm-variable">a0</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">b1</span>[<span class="cm-variable">i</span>]<span class="cm-operator">+</span><span class="cm-variable">a0</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">b0</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">Cpl</span>(<span class="cm-number">0</span>,<span class="cm-number">1</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">FFT</span>(<span class="cm-variable">c1</span>,<span class="cm-variable">x</span>,<span class="cm-number">1</span>);<span class="cm-variable">FFT</span>(<span class="cm-variable">c2</span>,<span class="cm-variable">x</span>,<span class="cm-number">1</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">ans</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span>(((<span class="cm-variable">ll</span>)<span class="cm-variable">round</span>(<span class="cm-variable">c1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span>)<span class="cm-operator">%</span><span class="cm-variable">p</span><span class="cm-operator">&lt;&lt;</span><span class="cm-number">30</span>)<span class="cm-operator">%</span><span class="cm-variable">p</span><span class="cm-operator">+</span>((<span class="cm-variable">ll</span>)<span class="cm-variable">round</span>(<span class="cm-variable">c2</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span>)<span class="cm-operator">%</span><span class="cm-variable">p</span><span class="cm-operator">&lt;&lt;</span><span class="cm-number">15</span>)<span class="cm-operator">%</span><span class="cm-variable">p</span><span class="cm-operator">+</span>(<span class="cm-variable">ll</span>)<span class="cm-variable">round</span>(<span class="cm-variable">c2</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span>)<span class="cm-operator">%</span><span class="cm-variable">p</span>)<span class="cm-operator">%</span><span class="cm-variable">p</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">a1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">a1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>,<span class="cm-variable">b1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">b1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>,<span class="cm-variable">a0</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">a0</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>,<span class="cm-variable">b0</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">b0</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>,<span class="cm-variable">c1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">c1</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>,<span class="cm-variable">c2</span>[<span class="cm-variable">i</span>].<span class="cm-variable">r</span><span class="cm-operator">=</span><span class="cm-variable">c2</span>[<span class="cm-variable">i</span>].<span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">} </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">T</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">N</span>,<span class="cm-variable">P</span>,<span class="cm-variable">B</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">Init</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">maxN</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">W</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">Cpl</span>(<span class="cm-variable">cos</span>(<span class="cm-variable">i</span><span class="cm-operator">*</span><span class="cm-variable">Pi</span><span class="cm-operator">/</span>(<span class="cm-variable">maxN</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>)),<span class="cm-variable">sin</span>(<span class="cm-variable">i</span><span class="cm-operator">*</span><span class="cm-variable">Pi</span><span class="cm-operator">/</span>(<span class="cm-variable">maxN</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>))),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">iW</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">Cpl</span>(<span class="cm-variable">cos</span>(<span class="cm-variable">i</span><span class="cm-operator">*</span><span class="cm-variable">Pi</span><span class="cm-operator">/</span>(<span class="cm-variable">maxN</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>)),<span class="cm-operator">-</span><span class="cm-variable">sin</span>(<span class="cm-variable">i</span><span class="cm-operator">*</span><span class="cm-variable">Pi</span><span class="cm-operator">/</span>(<span class="cm-variable">maxN</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>)));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">fac</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">inv</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">ifac</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">init</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">inv</span>[<span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-variable">fac</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-variable">fac</span>[<span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-variable">ifac</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-variable">ifac</span>[<span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">2</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">maxN</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">fac</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">fac</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>]<span class="cm-operator">*</span><span class="cm-variable">i</span><span class="cm-operator">%</span><span class="cm-variable">P</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">inv</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span>(<span class="cm-variable">P</span><span class="cm-operator">-</span><span class="cm-variable">P</span><span class="cm-operator">/</span><span class="cm-variable">i</span>)<span class="cm-operator">*</span><span class="cm-variable">inv</span>[<span class="cm-variable">P</span><span class="cm-operator">%</span><span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">ifac</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">ifac</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>]<span class="cm-operator">*</span><span class="cm-variable">inv</span>[<span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-def">qpow</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">a</span>,<span class="cm-variable-3">int</span> <span class="cm-variable">k</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">while</span>(<span class="cm-variable">k</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">k</span><span class="cm-operator">&amp;</span><span class="cm-number">1</span>) <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">ans</span><span class="cm-operator">*</span><span class="cm-variable">a</span><span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">a</span><span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">a</span><span class="cm-operator">*</span><span class="cm-variable">a</span><span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">k</span><span class="cm-operator">&gt;&gt;=</span><span class="cm-number">1</span>; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">return</span> <span class="cm-variable">ans</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">d</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">F</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">ADD1</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">k</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">k</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">k</span><span class="cm-operator">++</span>) <span class="cm-variable">F</span>[<span class="cm-variable">k</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">F</span>[<span class="cm-variable">k</span>]<span class="cm-operator">*</span>(<span class="cm-variable">k</span><span class="cm-operator">*</span><span class="cm-variable">B</span><span class="cm-operator">+</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>)<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">F</span>[<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">F</span>[<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">F</span>[<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">*</span>((<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>)<span class="cm-operator">*</span><span class="cm-variable">B</span><span class="cm-operator">+</span><span class="cm-variable">i</span>)<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">d</span><span class="cm-operator">++</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">preS</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">sufS</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">invS</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">f</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">g</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">LIP</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">h</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">ans</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">k</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">x</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-keyword">while</span>(<span class="cm-variable">x</span><span class="cm-operator">&lt;</span><span class="cm-number">4</span><span class="cm-operator">*</span><span class="cm-variable">d</span>) <span class="cm-variable">x</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">f</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">//get G : inv k-d~k+d</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span>((<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-variable">k</span>)<span class="cm-operator">%</span><span class="cm-variable">P</span><span class="cm-operator">-</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-variable">P</span>)<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">preS</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-variable">g</span>[<span class="cm-number">0</span>];<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">preS</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">preS</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>]<span class="cm-operator">*</span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">sufS</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>]<span class="cm-operator">=</span><span class="cm-variable">g</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>];<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span><span class="cm-operator">-</span><span class="cm-number">1</span>;<span class="cm-variable">~i</span>;<span class="cm-variable">i</span><span class="cm-operator">--</span>) <span class="cm-variable">sufS</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">sufS</span>[<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">*</span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">invS</span><span class="cm-operator">=</span><span class="cm-variable">qpow</span>(<span class="cm-variable">preS</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>],<span class="cm-variable">P</span><span class="cm-operator">-</span><span class="cm-number">2</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">invS</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">i</span><span class="cm-operator">!=</span><span class="cm-number">0</span>) <span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">preS</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">i</span><span class="cm-operator">!=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>) <span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">sufS</span>[<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">//get F</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">f</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">h</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">ifac</span>[<span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span><span class="cm-operator">*</span><span class="cm-variable">ifac</span>[<span class="cm-variable">d</span><span class="cm-operator">-</span><span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>((<span class="cm-variable">d</span><span class="cm-operator">-</span><span class="cm-variable">i</span>)<span class="cm-operator">&amp;</span><span class="cm-number">1</span>) <span class="cm-variable">f</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span>(<span class="cm-variable">P</span><span class="cm-operator">-</span><span class="cm-variable">f</span>[<span class="cm-variable">i</span>])<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">//main part</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">Conv</span>(<span class="cm-variable">f</span>,<span class="cm-variable">g</span>,<span class="cm-variable">ans</span>,<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>,<span class="cm-variable">P</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">mul</span><span class="cm-operator">=</span><span class="cm-variable">preS</span>[<span class="cm-variable">d</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">ans</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">ans</span>[<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-variable">d</span>]<span class="cm-operator">*</span><span class="cm-variable">mul</span><span class="cm-operator">%</span><span class="cm-variable">P</span>,<span class="cm-variable">mul</span><span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">mul</span><span class="cm-operator">*</span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span><span class="cm-operator">*</span>(<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-number">1</span><span class="cm-operator">+</span><span class="cm-variable">k</span>)<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">G</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">MUL2</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">d</span><span class="cm-operator">==</span><span class="cm-number">0</span>) <span class="cm-keyword">return</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">LIP</span>(<span class="cm-variable">F</span>,<span class="cm-variable">F</span><span class="cm-operator">+</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>,<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>);<span class="cm-variable">F</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">d</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">LIP</span>(<span class="cm-variable">F</span>,<span class="cm-variable">G</span>,<span class="cm-number">1LL</span><span class="cm-operator">*</span>(<span class="cm-variable">d</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>)<span class="cm-operator">*</span><span class="cm-variable">qpow</span>(<span class="cm-variable">B</span>,<span class="cm-variable">P</span><span class="cm-operator">-</span><span class="cm-number">2</span>)<span class="cm-operator">%</span><span class="cm-variable">P</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">F</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">F</span>[<span class="cm-variable">i</span>]<span class="cm-operator">*</span><span class="cm-variable">G</span>[<span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">signed</span> <span class="cm-def">main</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">Init</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">scanf</span>(<span class="cm-string">"%d"</span>,<span class="cm-operator">&amp;</span><span class="cm-variable">T</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"><span class="cm-comment">//<span class="cm-tab" role="presentation" cm-text="	">  </span>T=5;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">while</span>(<span class="cm-variable">T</span><span class="cm-operator">--</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">scanf</span>(<span class="cm-string">"%lld%lld"</span>,<span class="cm-operator">&amp;</span><span class="cm-variable">N</span>,<span class="cm-operator">&amp;</span><span class="cm-variable">P</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"><span class="cm-comment">//<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span>N=998244353,P=1000000007;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">B</span><span class="cm-operator">=</span><span class="cm-variable">sqrt</span>(<span class="cm-variable">N</span>);<span class="cm-variable">init</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">d</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">F</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">20</span>;<span class="cm-variable">~i</span>;<span class="cm-variable">i</span><span class="cm-operator">--</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">MUL2</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>((<span class="cm-variable">B</span><span class="cm-operator">&gt;&gt;</span><span class="cm-variable">i</span>)<span class="cm-operator">&amp;</span><span class="cm-number">1</span>) <span class="cm-variable">ADD1</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">B</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">ans</span><span class="cm-operator">*</span><span class="cm-variable">F</span>[<span class="cm-variable">i</span>]<span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-variable">B</span><span class="cm-operator">*</span><span class="cm-variable">B</span><span class="cm-operator">+</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">N</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-number">1LL</span><span class="cm-operator">*</span><span class="cm-variable">ans</span><span class="cm-operator">*</span><span class="cm-variable">i</span><span class="cm-operator">%</span><span class="cm-variable">P</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">printf</span>(<span class="cm-string">"%lld\n"</span>,<span class="cm-variable">ans</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 3473px;"></div><div class="CodeMirror-gutters" style="display: none; height: 3473px;"></div></div></div></pre><ul><li><a href='https://loj.ac/problem/170'><span>#170. 阶乘 mod 大质数</span></a></li></ul><p><span>请注意常数因子.jpg</span></p><p><span>参考代码：</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="cpp" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="cpp"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#include&lt;bits/stdc++.h&gt;</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#define ll long long</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#define int long long</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">#define db long double</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-keyword">namespace</span> <span class="cm-def">std</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">const</span> <span class="cm-variable-3">int</span> <span class="cm-variable">maxN</span><span class="cm-operator">=</span><span class="cm-number">2097152</span>,<span class="cm-variable">p</span><span class="cm-operator">=</span><span class="cm-number">1000391835649ll</span>,<span class="cm-variable">gg</span><span class="cm-operator">=</span><span class="cm-number">7</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">ig</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">ll</span> <span class="cm-def">mul</span>(<span class="cm-variable">ll</span> <span class="cm-variable">x</span>,<span class="cm-variable">ll</span> <span class="cm-variable">y</span>){<span class="cm-keyword">return</span> ((((<span class="cm-variable">x</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">20</span>)<span class="cm-operator">*</span><span class="cm-variable">y</span><span class="cm-operator">%</span><span class="cm-variable">p</span>)<span class="cm-operator">&lt;&lt;</span><span class="cm-number">20</span>)<span class="cm-operator">+</span>(<span class="cm-variable">x</span><span class="cm-operator">&amp;</span><span class="cm-number">1048575</span>)<span class="cm-operator">*</span><span class="cm-variable">y</span>)<span class="cm-operator">%</span><span class="cm-variable">p</span>;}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">ll</span> <span class="cm-def">add</span>(<span class="cm-variable">ll</span> <span class="cm-variable">x</span>,<span class="cm-variable">ll</span> <span class="cm-variable">y</span>){<span class="cm-keyword">return</span> (<span class="cm-variable">x</span><span class="cm-operator">+</span><span class="cm-variable">y</span>)<span class="cm-operator">&gt;=</span><span class="cm-variable">p</span><span class="cm-operator">?</span><span class="cm-variable">x</span><span class="cm-operator">+</span><span class="cm-variable">y</span><span class="cm-operator">-</span><span class="cm-variable">p</span>:<span class="cm-variable">x</span><span class="cm-operator">+</span><span class="cm-variable">y</span>;}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">W</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">iW</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">fac</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">ifac</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">inv</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-def">qpow</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">a</span>,<span class="cm-variable-3">int</span> <span class="cm-variable">k</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable-3">int</span> <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">while</span>(<span class="cm-variable">k</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span>(<span class="cm-variable">k</span><span class="cm-operator">&amp;</span><span class="cm-number">1</span>) <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">ans</span>,<span class="cm-variable">a</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">a</span><span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">a</span>,<span class="cm-variable">a</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">k</span><span class="cm-operator">&gt;&gt;=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">ans</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">init</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">ig</span><span class="cm-operator">=</span><span class="cm-variable">qpow</span>(<span class="cm-variable">gg</span>,<span class="cm-variable">p</span><span class="cm-operator">-</span><span class="cm-number">2</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">w</span><span class="cm-operator">=</span><span class="cm-variable">qpow</span>(<span class="cm-variable">gg</span>,(<span class="cm-variable">p</span><span class="cm-operator">-</span><span class="cm-number">1</span>)<span class="cm-operator">/</span><span class="cm-variable">maxN</span>),<span class="cm-variable">iw</span><span class="cm-operator">=</span><span class="cm-variable">qpow</span>(<span class="cm-variable">ig</span>,(<span class="cm-variable">p</span><span class="cm-operator">-</span><span class="cm-number">1</span>)<span class="cm-operator">/</span><span class="cm-variable">maxN</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">W</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-variable">iW</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">maxN</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">W</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">W</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>],<span class="cm-variable">w</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">iW</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">iW</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>],<span class="cm-variable">iw</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">fac</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-variable">ifac</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-variable">fac</span>[<span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-variable">ifac</span>[<span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-variable">inv</span>[<span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">2</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">maxN</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  <span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">fac</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">fac</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>],<span class="cm-variable">i</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  <span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">inv</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">p</span><span class="cm-operator">-</span><span class="cm-variable">p</span><span class="cm-operator">/</span><span class="cm-variable">i</span>,<span class="cm-variable">inv</span>[<span class="cm-variable">p</span><span class="cm-operator">%</span><span class="cm-variable">i</span>]),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  <span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">ifac</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">ifac</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>],<span class="cm-variable">inv</span>[<span class="cm-variable">i</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">R</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">NTT</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">d</span>[],<span class="cm-variable-3">bool</span> <span class="cm-variable">flg</span>,<span class="cm-variable-3">int</span> <span class="cm-variable">n0</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable-3">int</span> <span class="cm-variable">x</span><span class="cm-operator">=</span><span class="cm-number">1</span>,<span class="cm-variable">len</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-keyword">while</span>(<span class="cm-variable">x</span><span class="cm-operator">&lt;</span><span class="cm-variable">n0</span>) <span class="cm-variable">x</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>,<span class="cm-variable">len</span><span class="cm-operator">++</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">R</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span>(<span class="cm-variable">R</span>[<span class="cm-variable">i</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>]<span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>)<span class="cm-operator">|</span>((<span class="cm-variable">i</span><span class="cm-operator">&amp;</span><span class="cm-number">1</span>)<span class="cm-operator">&lt;&lt;</span>(<span class="cm-variable">len</span><span class="cm-operator">-</span><span class="cm-number">1</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span>(<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">R</span>[<span class="cm-variable">i</span>]) <span class="cm-variable">swap</span>(<span class="cm-variable">d</span>[<span class="cm-variable">i</span>],<span class="cm-variable">d</span>[<span class="cm-variable">R</span>[<span class="cm-variable">i</span>]]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>,<span class="cm-variable">l</span><span class="cm-operator">=</span><span class="cm-variable">maxN</span><span class="cm-operator">/</span>(<span class="cm-variable">i</span><span class="cm-operator">&lt;&lt;</span><span class="cm-number">1</span>);<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>,<span class="cm-variable">l</span><span class="cm-operator">&gt;&gt;=</span><span class="cm-number">1</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">j</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">j</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">j</span><span class="cm-operator">+=</span>(<span class="cm-variable">i</span><span class="cm-operator">&lt;&lt;</span><span class="cm-number">1</span>))</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">k</span><span class="cm-operator">=</span><span class="cm-number">0</span>,<span class="cm-variable">u</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">k</span><span class="cm-operator">&lt;</span><span class="cm-variable">i</span>;<span class="cm-variable">k</span><span class="cm-operator">++</span>,<span class="cm-variable">u</span><span class="cm-operator">+=</span><span class="cm-variable">l</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">int</span> <span class="cm-variable">a0</span><span class="cm-operator">=</span><span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">|</span><span class="cm-variable">k</span>],<span class="cm-variable">a1</span><span class="cm-operator">=</span><span class="cm-variable">mul</span>((<span class="cm-variable">flg</span><span class="cm-operator">?</span><span class="cm-variable">iW</span>[<span class="cm-variable">u</span>]:<span class="cm-variable">W</span>[<span class="cm-variable">u</span>]),<span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">|</span><span class="cm-variable">i</span><span class="cm-operator">|</span><span class="cm-variable">k</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">|</span><span class="cm-variable">k</span>]<span class="cm-operator">=</span><span class="cm-variable">add</span>(<span class="cm-variable">a0</span>,<span class="cm-variable">a1</span>);<span class="cm-variable">d</span>[<span class="cm-variable">j</span><span class="cm-operator">|</span><span class="cm-variable">i</span><span class="cm-operator">|</span><span class="cm-variable">k</span>]<span class="cm-operator">=</span><span class="cm-variable">add</span>(<span class="cm-variable">a0</span>,<span class="cm-operator">-</span><span class="cm-variable">a1</span><span class="cm-operator">+</span><span class="cm-variable">p</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">if</span>(<span class="cm-variable">flg</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">int</span> <span class="cm-variable">invx</span><span class="cm-operator">=</span><span class="cm-variable">qpow</span>(<span class="cm-variable">x</span>,<span class="cm-variable">p</span><span class="cm-operator">-</span><span class="cm-number">2</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">d</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">d</span>[<span class="cm-variable">i</span>],<span class="cm-variable">invx</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">T</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">N</span>,<span class="cm-variable">B</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">d</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">F</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">ADD1</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">k</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">k</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">k</span><span class="cm-operator">++</span>) <span class="cm-variable">F</span>[<span class="cm-variable">k</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">F</span>[<span class="cm-variable">k</span>],<span class="cm-variable">k</span><span class="cm-operator">*</span><span class="cm-variable">B</span><span class="cm-operator">+</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">F</span>[<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">F</span>[<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">F</span>[<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>],(<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>)<span class="cm-operator">*</span><span class="cm-variable">B</span><span class="cm-operator">+</span><span class="cm-variable">i</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">d</span><span class="cm-operator">++</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">preS</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">sufS</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">invS</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">f</span>[<span class="cm-variable">maxN</span>],<span class="cm-variable">g</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">LIP</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">h</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">ans</span>[],<span class="cm-variable-3">int</span> <span class="cm-variable">k</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">x</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-keyword">while</span>(<span class="cm-variable">x</span><span class="cm-operator">&lt;</span><span class="cm-number">2</span><span class="cm-operator">*</span>(<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>)) <span class="cm-variable">x</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">f</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">//get G : inv k-d~k+d</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">add</span>(<span class="cm-variable">add</span>(<span class="cm-variable">i</span>,<span class="cm-variable">k</span>),<span class="cm-operator">-</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-variable">p</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">preS</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-variable">g</span>[<span class="cm-number">0</span>];<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">preS</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">preS</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>],<span class="cm-variable">g</span>[<span class="cm-variable">i</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">sufS</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>]<span class="cm-operator">=</span><span class="cm-variable">g</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>];<span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span><span class="cm-operator">-</span><span class="cm-number">1</span>;<span class="cm-variable">~i</span>;<span class="cm-variable">i</span><span class="cm-operator">--</span>) <span class="cm-variable">sufS</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">sufS</span>[<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-number">1</span>],<span class="cm-variable">g</span>[<span class="cm-variable">i</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">invS</span><span class="cm-operator">=</span><span class="cm-variable">qpow</span>(<span class="cm-variable">preS</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>],<span class="cm-variable">p</span><span class="cm-operator">-</span><span class="cm-number">2</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">invS</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">i</span><span class="cm-operator">!=</span><span class="cm-number">0</span>) <span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">g</span>[<span class="cm-variable">i</span>],<span class="cm-variable">preS</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">i</span><span class="cm-operator">!=</span><span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span>) <span class="cm-variable">g</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">g</span>[<span class="cm-variable">i</span>],<span class="cm-variable">sufS</span>[<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-number">1</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">//get F</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">f</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">mul</span>(<span class="cm-variable">h</span>[<span class="cm-variable">i</span>],<span class="cm-variable">ifac</span>[<span class="cm-variable">i</span>]),<span class="cm-variable">ifac</span>[<span class="cm-variable">d</span><span class="cm-operator">-</span><span class="cm-variable">i</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>((<span class="cm-variable">d</span><span class="cm-operator">-</span><span class="cm-variable">i</span>)<span class="cm-operator">&amp;</span><span class="cm-number">1</span>) <span class="cm-variable">f</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">add</span>(<span class="cm-variable">p</span>,<span class="cm-operator">-</span><span class="cm-variable">f</span>[<span class="cm-variable">i</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">//main part</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">NTT</span>(<span class="cm-variable">f</span>,<span class="cm-number">0</span>,<span class="cm-variable">x</span>);<span class="cm-variable">NTT</span>(<span class="cm-variable">g</span>,<span class="cm-number">0</span>,<span class="cm-variable">x</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;</span><span class="cm-variable">x</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">ans</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">f</span>[<span class="cm-variable">i</span>],<span class="cm-variable">g</span>[<span class="cm-variable">i</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">NTT</span>(<span class="cm-variable">ans</span>,<span class="cm-number">1</span>,<span class="cm-variable">x</span>);<span class="cm-variable">NTT</span>(<span class="cm-variable">g</span>,<span class="cm-number">1</span>,<span class="cm-variable">x</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">mul0</span><span class="cm-operator">=</span><span class="cm-variable">preS</span>[<span class="cm-variable">d</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">ans</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">ans</span>[<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-variable">d</span>],<span class="cm-variable">mul0</span>),<span class="cm-variable">mul0</span><span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">mul</span>(<span class="cm-variable">mul0</span>,<span class="cm-variable">g</span>[<span class="cm-variable">i</span>]),<span class="cm-variable">i</span><span class="cm-operator">+</span><span class="cm-number">1</span><span class="cm-operator">+</span><span class="cm-variable">k</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">int</span> <span class="cm-variable">G</span>[<span class="cm-variable">maxN</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">void</span> <span class="cm-def">MUL2</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">d</span><span class="cm-operator">==</span><span class="cm-number">0</span>) <span class="cm-keyword">return</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">LIP</span>(<span class="cm-variable">F</span>,<span class="cm-variable">F</span><span class="cm-operator">+</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>,<span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>);<span class="cm-variable">F</span>[<span class="cm-number">2</span><span class="cm-operator">*</span><span class="cm-variable">d</span><span class="cm-operator">+</span><span class="cm-number">1</span>]<span class="cm-operator">=</span><span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">d</span><span class="cm-operator">&lt;&lt;=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">LIP</span>(<span class="cm-variable">F</span>,<span class="cm-variable">G</span>,<span class="cm-variable">mul</span>(<span class="cm-variable">d</span><span class="cm-operator">&gt;&gt;</span><span class="cm-number">1</span>,<span class="cm-variable">qpow</span>(<span class="cm-variable">B</span>,<span class="cm-variable">p</span><span class="cm-operator">-</span><span class="cm-number">2</span>)));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">d</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">F</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">F</span>[<span class="cm-variable">i</span>],<span class="cm-variable">G</span>[<span class="cm-variable">i</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable-3">signed</span> <span class="cm-def">main</span>(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">init</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">N</span><span class="cm-operator">=</span><span class="cm-number">1000391835648LL</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">B</span><span class="cm-operator">=</span><span class="cm-variable">sqrt</span>(<span class="cm-variable">N</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">d</span><span class="cm-operator">=</span><span class="cm-number">0</span>;<span class="cm-variable">F</span>[<span class="cm-number">0</span>]<span class="cm-operator">=</span><span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">20</span>;<span class="cm-variable">~i</span>;<span class="cm-variable">i</span><span class="cm-operator">--</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">MUL2</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>((<span class="cm-variable">B</span><span class="cm-operator">&gt;&gt;</span><span class="cm-variable">i</span>)<span class="cm-operator">&amp;</span><span class="cm-number">1</span>) <span class="cm-variable">ADD1</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"><span class="cm-comment">//<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span>printf("check %d\n",i);</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">B</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">F</span>[<span class="cm-variable">i</span>]<span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">F</span>[<span class="cm-variable">i</span>],<span class="cm-variable">F</span>[<span class="cm-variable">i</span><span class="cm-operator">-</span><span class="cm-number">1</span>]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">scanf</span>(<span class="cm-string">"%d"</span>,<span class="cm-operator">&amp;</span><span class="cm-variable">T</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">while</span>(<span class="cm-variable">T</span><span class="cm-operator">--</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">scanf</span>(<span class="cm-string">"%lld"</span>,<span class="cm-operator">&amp;</span><span class="cm-variable">N</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable-3">int</span> <span class="cm-variable">k</span><span class="cm-operator">=</span><span class="cm-variable">N</span><span class="cm-operator">/</span><span class="cm-variable">B</span>,<span class="cm-variable">ans</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">if</span>(<span class="cm-variable">k</span><span class="cm-operator">==</span><span class="cm-number">0</span>) <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-number">1</span>;<span class="cm-keyword">else</span> <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-variable">F</span>[<span class="cm-variable">k</span><span class="cm-operator">-</span><span class="cm-number">1</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-keyword">for</span>(<span class="cm-variable-3">int</span> <span class="cm-variable">i</span><span class="cm-operator">=</span><span class="cm-variable">k</span><span class="cm-operator">*</span><span class="cm-variable">B</span><span class="cm-operator">+</span><span class="cm-number">1</span>;<span class="cm-variable">i</span><span class="cm-operator">&lt;=</span><span class="cm-variable">N</span>;<span class="cm-variable">i</span><span class="cm-operator">++</span>) <span class="cm-variable">ans</span><span class="cm-operator">=</span><span class="cm-variable">mul</span>(<span class="cm-variable">ans</span>,<span class="cm-variable">i</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-variable">printf</span>(<span class="cm-string">"%lld\n"</span>,<span class="cm-variable">ans</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 2783px;"></div><div class="CodeMirror-gutters" style="display: none; height: 2783px;"></div></div></div></pre></div>
</body>
</html>